{"record":{"id":"f64f337f94fa8718","repo":"StockSharp/StockSharp","slug":"candlesseries-f64f33","errorCode":null,"errorMessage":"candlesSeries","messagePattern":"candlesSeries","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Gpu/Indicators/GpuEaseOfMovementCalculator.cs","lineNumber":54,"sourceCode":"\t/// Initializes a new instance of the <see cref=\"GpuEaseOfMovementCalculator\"/> class.\n\t/// </summary>\n\t/// <param name=\"context\">ILGPU context.</param>\n\t/// <param name=\"accelerator\">ILGPU accelerator.</param>\n\tpublic GpuEaseOfMovementCalculator(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<float>, ArrayView<int>, ArrayView<int>, ArrayView<GpuEaseOfMovementParams>>(EaseOfMovementParamsSeriesKernel);\n\t}\n\n\t/// <inheritdoc />\n\tpublic override GpuIndicatorResult[][][] Calculate(GpuCandle[][] candlesSeries, GpuEaseOfMovementParams[] 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\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\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","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Gpu/Indicators/GpuEaseOfMovementCalculator.cs#L36-L72","documentation":"Thrown by GpuEaseOfMovementCalculator.Calculate as ArgumentOutOfRangeException(nameof(candlesSeries)) when the outer GpuCandle[][] has Length 0. With seriesCount 0 the Index2D(parameters.Length, seriesCount) kernel dispatch is degenerate and output buffers would be shapeless, so the empty outer array is rejected before flattening.","triggerScenarios":"Calling GpuEaseOfMovementCalculator.Calculate(Array.Empty<GpuCandle[]>(), parameters) or passing a GpuCandle[][] whose outer length is 0.","commonSituations":"Empty symbol universe after filtering, date window with no candles, weekend/holiday query, or loader returning an empty batch.","solutions":["Guard candlesSeries.Length > 0 before the call and skip empty batches.","Ensure the upstream loader/filter never yields a zero-length outer array.","Handle 'no data' as a no-op earlier in the pipeline.","Verify the data source returned bars for the requested symbols/dates."],"exampleFix":"// before\ncalc.Calculate(candlesSeries, parameters);\n\n// after\nif (candlesSeries is null || candlesSeries.Length == 0)\n    return Array.Empty<GpuIndicatorResult[][]>();\ncalc.Calculate(candlesSeries, parameters);","handlingStrategy":"validation","validationCode":"// C#\nif (candlesSeries is null || candlesSeries.Length == 0)\n{\n    return Array.Empty<GpuIndicatorResult[][]>();\n}\n// safe to call: calculator.Calculate(candlesSeries, parameters);","typeGuard":"// C#\nstatic bool HasAnySeries(GpuCandle[][] candlesSeries)\n    => candlesSeries is { Length: > 0 };","tryCatchPattern":"try\n{\n    result = calculator.Calculate(candlesSeries, parameters);\n}\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"candlesSeries\")\n{\n    _logger.LogWarning(\"Empty candlesSeries passed to {Calc}\", calculator.GetType().Name);\n    result = Array.Empty<GpuIndicatorResult[][]>();\n}","preventionTips":["Ensure the candle loader never returns a zero-length outer array.","Filter the symbol universe before batching and skip empty batches.","Treat 'no series' as a no-op earlier in the pipeline.","Note inner null/empty series are tolerated but the outer array must be non-empty."],"tags":["argument-validation","gpu","ilgpu","indicators","argument-out-of-range"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}