{"record":{"id":"89bc1a091c680d8c","repo":"StockSharp/StockSharp","slug":"specified-argument-was-out-of-the-range-of-valid-v-89bc1a","errorCode":null,"errorMessage":"Specified argument was out of the range of valid values. (Parameter 'parameters')","messagePattern":"Specified argument was out of the range of valid values\\. \\(Parameter 'parameters'\\)","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Gpu/Indicators/GpuNickRypockTrailingReverseCalculator.cs","lineNumber":72,"sourceCode":"\t/// <param name=\"accelerator\">ILGPU accelerator.</param>\n\tpublic GpuNickRypockTrailingReverseCalculator(Context context, Accelerator accelerator)\n\t\t: base(context, accelerator)\n\t{\n\t\t_kernel = Accelerator.LoadAutoGroupedStreamKernel\n\t\t\t\t<Index2D, ArrayView<GpuCandle>, ArrayView<GpuIndicatorResult>, ArrayView<int>, ArrayView<int>, ArrayView<GpuNickRypockTrailingReverseParams>>(NickRypockTrailingReverseParamsSeriesKernel);\n\t}\n\n\t/// <inheritdoc />\n\tpublic override GpuIndicatorResult[][][] Calculate(GpuCandle[][] candlesSeries, GpuNickRypockTrailingReverseParams[] parameters)\n\t{\n\t\tArgumentNullException.ThrowIfNull(candlesSeries);\n\t\tArgumentNullException.ThrowIfNull(parameters);\n\n\t\tif (candlesSeries.Length == 0)\n\t\t\tthrow new ArgumentOutOfRangeException(nameof(candlesSeries));\n\n\t\tif (parameters.Length == 0)\n\t\t\tthrow new ArgumentOutOfRangeException(nameof(parameters));\n\n\t\tvar seriesCount = candlesSeries.Length;\n\n\t\t// Flatten input series\n\t\tvar totalSize = 0;\n\t\tvar seriesOffsets = new int[seriesCount];\n\t\tvar seriesLengths = new int[seriesCount];\n\n\t\tfor (var s = 0; s < seriesCount; s++)\n\t\t{\n\t\t\tseriesOffsets[s] = totalSize;\n\t\t\tvar len = candlesSeries[s]?.Length ?? 0;\n\t\t\tseriesLengths[s] = len;\n\t\t\ttotalSize += len;\n\t\t}\n\n\t\tvar flatCandles = new GpuCandle[totalSize];\n\t\tvar offset = 0;","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Gpu/Indicators/GpuNickRypockTrailingReverseCalculator.cs#L54-L90","documentation":"GpuNickRypockTrailingReverseCalculator.Calculate throws ArgumentOutOfRangeException when the parameters array (GpuNickRypockTrailingReverseParams[]) is empty. Each parameter set defines trailing-reverse sensitivity; with zero sets there is nothing to compute, so the guard surfaces the issue.","triggerScenarios":"Calling Calculate with Array.Empty<GpuNickRypockTrailingReverseParams>() or a zero-length parameters array.","commonSituations":"Nick Rypock config not loaded; parameter sweep excluded all configs; deserialization bug produced an empty array from a valid config file.","solutions":["Verify parameters.Length > 0 before calling Calculate","Supply a default parameter set when none are configured","Inspect the config loading path for silent empty-array returns"],"exampleFix":"// before\nvar results = calculator.Calculate(candlesSeries, parameters);\n\n// after\nif (parameters is null || parameters.Length == 0)\n    throw new InvalidOperationException(\"No Nick Rypock parameter sets configured.\");\nvar results = calculator.Calculate(candlesSeries, parameters);","handlingStrategy":"validation","validationCode":"// Validate before calling GpuNickRypockTrailingReverseCalculator.Calculate\nif (parameters is null || parameters.Length == 0)\n{\n    throw new InvalidOperationException(\"At least one Nick Rypock parameter set is required.\");\n}","typeGuard":"static bool IsValidParameters(GpuNickRypockTrailingReverseParams[] parameters) =>\n    parameters is { Length: > 0 };","tryCatchPattern":"try\n{\n    var results = calculator.Calculate(candlesSeries, parameters);\n}\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == nameof(parameters))\n{\n    logger.LogWarning(\"Empty parameters passed to Nick Rypock calculator\");\n    return Array.Empty<GpuIndicatorResult[][]>();\n}","preventionTips":["Validate the Nick Rypock config at startup","Supply a default parameter set when none are configured","Trace the parameter construction path for empty-array bugs"],"tags":["gpu","validation","argument","ilgpu","nick-rypock","indicators"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}