{"record":{"id":"7eed50274e5119ec","repo":"StockSharp/StockSharp","slug":"parameters-7eed50","errorCode":null,"errorMessage":"parameters","messagePattern":"parameters","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Gpu/Indicators/GpuLinearRegressionForecastCalculator.cs","lineNumber":64,"sourceCode":"\t/// <param name=\"context\">ILGPU context.</param>\n\t/// <param name=\"accelerator\">ILGPU accelerator.</param>\n\tpublic GpuLinearRegressionForecastCalculator(Context context, Accelerator accelerator)\n\t\t: base(context, accelerator)\n\t{\n\t\t_kernel = Accelerator.LoadAutoGroupedStreamKernel<Index3D, ArrayView<GpuCandle>, ArrayView<GpuIndicatorResult>, ArrayView<int>, ArrayView<int>, ArrayView<GpuLinearRegressionForecastParams>>(LinearRegressionForecastParamsSeriesKernel);\n\t}\n\n\t/// <inheritdoc />\n\tpublic override GpuIndicatorResult[][][] Calculate(GpuCandle[][] candlesSeries, GpuLinearRegressionForecastParams[] 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\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 maxLen = 0;\n\t\tvar offset = 0;","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Gpu/Indicators/GpuLinearRegressionForecastCalculator.cs#L46-L82","documentation":"ArgumentOutOfRangeException with ParamName=\"parameters\", thrown by GpuLinearRegressionForecastCalculator.Calculate at `if (parameters.Length == 0) throw new ArgumentOutOfRangeException(nameof(parameters))` (Algo.Gpu/Indicators/GpuLinearRegressionForecastCalculator.cs:64). The Index3D grid's parameter dimension requires at least one GpuLinearRegressionForecastParams set; zero sets means the kernel has nothing to iterate, so the guard rejects it before launch.","triggerScenarios":"Passing an empty GpuLinearRegressionForecastParams[] — e.g. a period sweep that produced no valid combinations, or an empty config block.","commonSituations":"Optimization grids fully filtered by validation; empty `parameters:` in config; UI with no forecast-period selection; tests omitting params.","solutions":["Guard the caller: require parameters.Length >= 1 before invoking, else throw a clear domain exception or skip.","Verify the parameter-expansion step yields at least one valid set.","Inject a default forecast-params set when config supplies none."],"exampleFix":"// before\nvar results = calc.Calculate(candlesSeries, parameters);\n\n// after\nif (parameters is null || parameters.Length == 0)\n    throw new InvalidOperationException(\"At least one forecast parameter set is required.\");\nvar results = calc.Calculate(candlesSeries, parameters);","handlingStrategy":"validation","validationCode":"if (parameters is null || parameters.Length == 0)\n    throw new InvalidOperationException(\"At least one forecast parameter set is required.\");\nvar results = calc.Calculate(candlesSeries, parameters);","typeGuard":"static bool IsValidParams(GpuLinearRegressionForecastParams[] p) => p is not null && p.Length > 0;","tryCatchPattern":"try { var r = calc.Calculate(candlesSeries, parameters); }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"parameters\")\n{ /* surface config error */ }","preventionTips":["Validate the forecast-period sweep yields at least one valid set.","Default to a standard forecast horizon when config is empty.","Schema-check config to reject empty parameter blocks."],"tags":["gpu","argumentoutofrange","argument-validation","ilgpu","linearreg-forecast","indicators"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}