{"record":{"id":"e36a3fc9567c30d1","repo":"StockSharp/StockSharp","slug":"nameof-candlesseries-e36a3f","errorCode":null,"errorMessage":"nameof(candlesSeries)","messagePattern":"nameof\\(candlesSeries\\)","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Gpu/Indicators/GpuRelativeMomentumIndexCalculator.cs","lineNumber":69,"sourceCode":"\t/// Initializes a new instance of the <see cref=\"GpuRelativeMomentumIndexCalculator\"/> class.\n\t/// </summary>\n\t/// <param name=\"context\">ILGPU context.</param>\n\t/// <param name=\"accelerator\">ILGPU accelerator.</param>\n\tpublic GpuRelativeMomentumIndexCalculator(Context context, Accelerator accelerator)\n\t: base(context, accelerator)\n\t{\n\t\t_kernel = Accelerator.LoadAutoGroupedStreamKernel\n\t\t<Index3D, ArrayView<GpuCandle>, ArrayView<GpuIndicatorResult>, ArrayView<int>, ArrayView<int>, ArrayView<GpuRelativeMomentumIndexParams>>(RelativeMomentumIndexParamsSeriesKernel);\n\t}\n\n\t/// <inheritdoc />\n\tpublic override GpuIndicatorResult[][][] Calculate(GpuCandle[][] candlesSeries, GpuRelativeMomentumIndexParams[] 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\n\t\tvar totalSize = 0;\n\t\tvar seriesOffsets = new int[seriesCount];\n\t\tvar seriesLengths = new int[seriesCount];\n\t\tvar maxLen = 0;\n\n\t\tfor (var s = 0; s < seriesCount; s++)\n\t\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;","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Gpu/Indicators/GpuRelativeMomentumIndexCalculator.cs#L51-L87","documentation":"GpuRelativeMomentumIndexCalculator.Calculate throws ArgumentOutOfRangeException on the 'candlesSeries' guard when the outer series array is empty (Length == 0). The RMI 3D kernel flattens series into contiguous buffers and needs at least one series; null inner series are tolerated.","triggerScenarios":"Calling Calculate(Array.Empty<GpuCandle[]>(), parameters) or Calculate(new GpuCandle[0][], parameters).","commonSituations":"Filtered symbol set is empty; no candle data for the window; test omitted data.","solutions":["Provide a candlesSeries array with at least one inner series.","Skip the call and return empty results for an empty batch.","Assert the loader returned at least one series before the GPU call."],"exampleFix":"// before\ncalc.Calculate(Array.Empty<GpuCandle[]>(), parameters);\n// after\nif (candlesSeries.Length == 0) return Array.Empty<GpuIndicatorResult[][]>();\ncalc.Calculate(candlesSeries, parameters);","handlingStrategy":"validation","validationCode":"if (candlesSeries is null || candlesSeries.Length == 0) return Array.Empty<GpuIndicatorResult[][]>();","typeGuard":"static bool HasSeries(GpuCandle[][] series) => series is { Length: > 0 };","tryCatchPattern":null,"preventionTips":["Validate the series batch before calling the RMI calculator.","Null inner series are tolerated; an empty outer array is not.","Assert the loader returned data before the GPU call."],"tags":["gpu","argument-validation","csharp","indicators","relative-momentum"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}