{"record":{"id":"b8c8fe9c3171f5de","repo":"StockSharp/StockSharp","slug":"candlesseries-b8c8fe","errorCode":null,"errorMessage":"candlesSeries","messagePattern":"candlesSeries","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Gpu/Indicators/GpuTemaCalculator.cs","lineNumber":62,"sourceCode":"\t/// Initializes a new instance of the <see cref=\"GpuTemaCalculator\"/> class.\n\t/// </summary>\n\t/// <param name=\"context\">ILGPU context.</param>\n\t/// <param name=\"accelerator\">ILGPU accelerator.</param>\n\tpublic GpuTemaCalculator(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<GpuTemaParams>>(TemaParamsSeriesKernel);\n\t}\n\n\t/// <inheritdoc />\n\tpublic override GpuIndicatorResult[][][] Calculate(GpuCandle[][] candlesSeries, GpuTemaParams[] 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\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}","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Gpu/Indicators/GpuTemaCalculator.cs#L44-L80","documentation":"GpuTemaCalculator.Calculate throws ArgumentOutOfRangeException(nameof(candlesSeries)) at line 62 when the GpuCandle[][] array is empty. TEMA (Triple EMA) needs candle series for its triple smoothing chain; zero series means no computation is meaningful. The guard precedes input flattening and ILGPU buffer allocation.","triggerScenarios":"Calling Calculate with candlesSeries = Array.Empty<GpuCandle[]>(). Triggered by empty symbol universes or data fetches returning no series.","commonSituations":"Symbol selection yields no instruments; market-data fetch empty for the range; holiday/weekend no-data; empty backtest universe; test missing candle data.","solutions":["Pass at least one GpuCandle[] series.","Short-circuit upstream when the universe is empty.","Validate data-fetch and symbol resolution to report empty universes early.","Caller guard: if (candlesSeries.Length == 0) return empty;"],"exampleFix":"// before\ncalc.Calculate(Array.Empty<GpuCandle[]>(), parameters);\n\n// after\nif (candlesSeries.Length == 0) return Array.Empty<GpuIndicatorResult[][]>();\ncalc.Calculate(candlesSeries, parameters);","handlingStrategy":"validation","validationCode":"if (candlesSeries is null || candlesSeries.Length == 0)\n    throw new ArgumentException(\"At least one candle series is required.\", nameof(candlesSeries));","typeGuard":"static bool HasSeries(GpuCandle[][] series) => series is { Length: > 0 };","tryCatchPattern":"try { result = calc.Calculate(candlesSeries, parameters); }\ncatch (ArgumentOutOfRangeException ex) when (ex.ParamName == \"candlesSeries\")\n{ /* log empty universe; abort batch */ }","preventionTips":["Check candlesSeries.Length > 0 after symbol selection.","Treat empty universe as a pipeline stopper.","Log symbol counts through filters to detect silent collapse.","Seed tests with at least one non-empty series."],"tags":["argumentexception","gpu","ilgpu","validation","tema","candles"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}