{"record":{"id":"d5de71bcfda9ddf9","repo":"QuantConnect/Lean","slug":"duplicatesma-indicator-was-expected-to-have-proce","errorCode":null,"errorMessage":"_duplicateSMA indicator was expected to have processed 60 datapoints already","messagePattern":"_duplicateSMA indicator was expected to have processed 60 datapoints already","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs","lineNumber":98,"sourceCode":"            // Check _customWarmUp indicator has already been warmed up with the requested data\n            if (!_customNotInherit.IsReady)\n            {\n                throw new RegressionTestException(\"_customNotInherit indicator was expected to be ready\");\n            }\n            if (_customNotInherit.Samples != 60)\n            {\n                throw new RegressionTestException(\"_customNotInherit indicator was expected to have processed 60 datapoints already\");\n            }\n\n            WarmUpIndicator(\"SPY\", _duplicateSMA, Resolution.Minute);\n            // Check _customWarmUp indicator has already been warmed up with the requested data\n            if (!_duplicateSMA.IsReady)\n            {\n                throw new RegressionTestException(\"_duplicateSMA indicator was expected to be ready\");\n            }\n            if (_duplicateSMA.Samples != 60)\n            {\n                throw new RegressionTestException(\"_duplicateSMA indicator was expected to have processed 60 datapoints already\");\n            }\n        }\n\n        public override void OnData(Slice slice)\n        {\n            if (!Portfolio.Invested)\n            {\n                SetHoldings(\"SPY\", 1);\n            }\n\n            if (Time.Second == 0)\n            {\n                // Compute the difference between the indicators values\n                var diff = Math.Abs(_customNotWarmUp.Current.Value - _customWarmUp.Current.Value);\n                diff += Math.Abs(_customNotInherit.Current.Value - _customNotWarmUp.Current.Value);\n                diff += Math.Abs(_customNotInherit.Current.Value - _customWarmUp.Current.Value);\n                diff += Math.Abs(_duplicateSMA.Current.Value - _customWarmUp.Current.Value);\n                diff += Math.Abs(_duplicateSMA.Current.Value - _customNotWarmUp.Current.Value);","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs#L80-L116","documentation":"Thrown after WarmUpIndicator is called on a SimpleMovingAverage (_duplicateSMA, period 60) registered to SPY minute data. The regression asserts the indicator consumed exactly 60 historical samples during warm-up. A mismatch means Lean's warm-up subsystem did not feed the expected number of historical data points into the indicator before the live algorithm loop began.","triggerScenarios":"Calling WarmUpIndicator(\"SPY\", indicator, Resolution.Minute) on a period-60 SMA and then checking indicator.Samples != 60. The check fires when the warm-up history request returns fewer/more points than the indicator period, or when the indicator was already partially populated before warm-up.","commonSituations":"Insufficient historical data for SPY minute bars before the algorithm start date (2013-10-07), a custom indicator that does not implement IIndicatorWarmUpPeriodProvider, a changed WarmUpPeriod property, or a Lean version change that altered how RegisterIndicator + WarmUpIndicator interact (duplicate registrations of the same symbol/indicator pair).","solutions":["Verify at least 60 minute bars of SPY history exist before SetStartDate in the data feed / object store.","Ensure the indicator's WarmUpPeriod (or period for built-in indicators) is set to 60 and matches the resolution used in WarmUpIndicator.","Confirm RegisterIndicator was called before WarmUpIndicator so the consolidator wiring is in place.","Check for duplicate WarmUpIndicator calls on the same symbol that could double-count or skip samples."],"exampleFix":"// before\nWarmUpIndicator(\"SPY\", _duplicateSMA, Resolution.Minute);\nif (_duplicateSMA.Samples != 60) { throw ...; }\n\n// after — assert readiness and log actual sample count for diagnosis\nWarmUpIndicator(\"SPY\", _duplicateSMA, Resolution.Minute);\nif (_duplicateSMA.Samples != 60)\n{\n    throw new RegressionTestException($\"_duplicateSMA processed {_duplicateSMA.Samples}, expected 60\");\n}","handlingStrategy":"validation","validationCode":"// Before relying on the indicator, validate warm-up produced the expected samples\nWarmUpIndicator(\"SPY\", _duplicateSMA, Resolution.Minute);\nif (!_duplicateSMA.IsReady || _duplicateSMA.Samples < 60)\n{\n    throw new InvalidOperationException(\n        $\"Warm-up incomplete: IsReady={_duplicateSMA.IsReady}, Samples={_duplicateSMA.Samples}\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call RegisterIndicator before WarmUpIndicator so the consolidator is wired.","Confirm the data feed has at least [period] bars before the algorithm start date.","Use indicators whose WarmUpPeriod matches their period for predictable sample counts."],"tags":["quantconnect","indicator","warmup","sma","regression-test"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}