{"record":{"id":"ac8dfaaab3ceef2c","repo":"StockSharp/StockSharp","slug":"localizedstrings-invalidvalue-ac8dfa","errorCode":null,"errorMessage":"LocalizedStrings.InvalidValue","messagePattern":"LocalizedStrings\\.InvalidValue","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Indicators/LaguerreRSI.cs","lineNumber":45,"sourceCode":"\n\tprivate decimal _gamma;\n\n\t/// <summary>\n\t/// Gamma parameter.\n\t/// </summary>\n\t[Display(\n\t\tResourceType = typeof(LocalizedStrings),\n\t\tName = LocalizedStrings.GammaKey,\n\t\tDescription = LocalizedStrings.GammaDescriptionKey,\n\t\tGroupName = LocalizedStrings.GeneralKey)]\n\t[Range(0.000001, 0.999999)]\n\tpublic decimal Gamma\n\t{\n\t\tget => _gamma;\n\t\tset\n\t\t{\n\t\t\tif (value <= 0 || value >= 1)\n\t\t\t\tthrow new ArgumentOutOfRangeException(nameof(value), value, LocalizedStrings.InvalidValue);\n\n\t\t\tif (value == Gamma)\n\t\t\t\treturn;\n\n\t\t\t_gamma = value;\n\t\t\tReset();\n\t\t}\n\t}\n\n\t/// <inheritdoc />\n\tprotected override IIndicatorValue OnProcess(IIndicatorValue input)\n\t{\n\t\tvar price = input.ToDecimal(Source);\n\n\t\tvar gamma = Gamma;\n\t\tvar gamma1 = 1 - gamma;\n\n\t\tvar l0 = (1 - gamma) * price + gamma * _l0;","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Indicators/LaguerreRSI.cs#L27-L63","documentation":"LaguerreRSI.Gamma is the smoothing factor in John Ehlers' Laguerre RSI and must lie strictly inside the open interval (0, 1). Gamma == 0 freezes the filter and Gamma == 1 makes it unstable, so the setter throws ArgumentOutOfRangeException with LocalizedStrings.InvalidValue for value <= 0 or value >= 1. The [Range(0.000001, 0.999999)] attribute mirrors this in UI editors.","triggerScenarios":"Setting Gamma to exactly 0, exactly 1, or outside the range, e.g. `lr.Gamma = 0`, `lr.Gamma = 1m`, or `lr.Gamma = 1.5m`.","commonSituations":"Slider/spinner that allows the inclusive endpoints 0 or 1, percentage-style input (0–100) mistakenly fed directly as Gamma, or a deserialized value of 1.","solutions":["Set Gamma strictly between 0 and 1 (typical 0.5m–0.7m; default 0.5).","Clamp into the open interval: `lr.Gamma = Math.Clamp(g, 0.000001m, 0.999999m)`.","Map percentage input correctly: `lr.Gamma = pct / 100m` and reject endpoints."],"exampleFix":"// before\nlr.Gamma = 1m;\n// after\nlr.Gamma = 0.7m;","handlingStrategy":"validation","validationCode":"static decimal SanitizeGamma(decimal g) => Math.Clamp(g, 0.000001m, 0.999999m);\n// usage: lr.Gamma = SanitizeGamma(raw);","typeGuard":"static bool IsValidGamma(decimal g) => g > 0 && g < 1;","tryCatchPattern":"try { lr.Gamma = raw; }\ncatch (ArgumentOutOfRangeException) { lr.Gamma = 0.5m; }","preventionTips":["Use the existing [Range(0.000001, 0.999999)] attribute in UI binding.","Convert percentage input: gamma = pct/100 and reject 0% and 100%.","Test the inclusive endpoints 0 and 1 explicitly."],"tags":["stocksharp","indicator","argument-validation","laguerre","rsi"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}