{"record":{"id":"c5d6337a5e37b0ec","repo":"QuantConnect/Lean","slug":"customwarmup-indicator-was-expected-to-have-proce","errorCode":null,"errorMessage":"_customWarmUp indicator was expected to have processed 60 datapoints already","messagePattern":"_customWarmUp indicator was expected to have processed 60 datapoints already","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs","lineNumber":66,"sourceCode":"            _duplicateSMA = new SimpleMovingAverage(\"_duplicateSMA\", 60);\n\n            // Register the daily data of \"SPY\" to automatically update both indicators\n            RegisterIndicator(\"SPY\", _customWarmUp, Resolution.Minute);\n            RegisterIndicator(\"SPY\", _customNotWarmUp, Resolution.Minute);\n            RegisterIndicator(\"SPY\", _customNotInherit, Resolution.Minute);\n            RegisterIndicator(\"SPY\", _duplicateSMA, Resolution.Minute);\n\n            // Warm up _customWarmUp indicator\n            WarmUpIndicator(\"SPY\", _customWarmUp, Resolution.Minute);\n\n            // Check _customWarmUp indicator has already been warmed up with the requested data\n            if (!_customWarmUp.IsReady)\n            {\n                throw new RegressionTestException(\"_customWarmUp indicator was expected to be ready\");\n            }\n            if (_customWarmUp.Samples != 60)\n            {\n                throw new RegressionTestException(\"_customWarmUp indicator was expected to have processed 60 datapoints already\");\n            }\n\n            // Try to warm up _customNotWarmUp indicator. It's expected from LEAN to skip the warm up process\n            // because this indicator doesn't implement IIndicatorWarmUpPeriodProvider\n            WarmUpIndicator(\"SPY\", _customNotWarmUp, Resolution.Minute);\n\n            // Check _customNotWarmUp indicator is not ready, because the warm up process was skipped\n            if (_customNotWarmUp.IsReady)\n            {\n                throw new RegressionTestException(\"_customNotWarmUp indicator wasn't expected to be warmed up\");\n            }\n\n            WarmUpIndicator(\"SPY\", _customNotInherit, Resolution.Minute);\n            // 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            }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs#L48-L84","documentation":"This RegressionTestException is thrown in Initialize after confirming _customWarmUp.IsReady. It asserts that _customWarmUp.Samples equals exactly 60, verifying the warm-up process fed precisely WarmUpPeriod data points. LEAN throws it because warm-up should feed exactly one data point per period in the history window — more indicates duplicate feeding, fewer indicates insufficient history.","triggerScenarios":"_customWarmUp.Samples != 60 after WarmUpIndicator. If Samples > 60, the indicator was fed extra points (duplicate warm-up or pre-existing samples). If Samples < 60, the history provider delivered fewer than 60 minute bars before StartDate.","commonSituations":"History data file truncated so fewer than 60 pre-StartDate minute bars exist, warm-up feeding logic changed to feed a different count (e.g. WarmUpPeriod + 1), or the indicator was already partially fed before WarmUpIndicator was called.","solutions":["Log _customWarmUp.Samples to determine if it's above or below 60.","If below: verify minute history data exists for at least 60 bars before SetStartDate (2013-10-07).","If above: check that the indicator wasn't pre-fed by RegisterIndicator or a previous WarmUpIndicator call.","If testing engine changes, trace the warm-up history retrieval to confirm it fetches exactly WarmUpPeriod bars."],"exampleFix":"// before — if warm-up feeds WarmUpPeriod+1 bars due to off-by-one\n// Engine code (hypothetical):\nvar history = History<IBaseData>(symbol, warmUpPeriod + 1, resolution); // off by one\nforeach (var bar in history) indicator.Update(bar);\n\n// after\nvar history = History<IBaseData>(symbol, warmUpPeriod, resolution); // exact count\nforeach (var bar in history) indicator.Update(bar);","handlingStrategy":"validation","validationCode":"// Validate sample count after warm-up\nWarmUpIndicator(\"SPY\", _customWarmUp, Resolution.Minute);\nif (_customWarmUp.Samples != 60)\n    Log($\"Unexpected sample count: {_customWarmUp.Samples}, expected 60. Check history data availability.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure history data has at least WarmUpPeriod bars before StartDate.","Don't call RegisterIndicator with live data before WarmUpIndicator — it could add extra samples.","Verify the warm-up history fetch requests exactly WarmUpPeriod bars, not more."],"tags":["quantconnect","lean","indicator","warmup","samples","history","regression-test"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}