{"record":{"id":"3e246bcbe51bdebd","repo":"QuantConnect/Lean","slug":"customnotinherit-indicator-was-expected-to-be-rea","errorCode":null,"errorMessage":"_customNotInherit indicator was expected to be ready","messagePattern":"_customNotInherit indicator was expected to be ready","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs","lineNumber":83,"sourceCode":"            {\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            }\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","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs#L65-L101","documentation":"This RegressionTestException is thrown in Initialize after WarmUpIndicator(\"SPY\", _customNotInherit, Resolution.Minute). _customNotInherit is a built-in SimpleMovingAverage(60). It asserts IsReady == true, verifying that built-in LEAN indicators (which implement IIndicatorWarmUpPeriodProvider internally) are correctly warmed up by WarmUpIndicator.","triggerScenarios":"_customNotInherit.IsReady is false after WarmUpIndicator. This means the built-in SMA's warm-up failed. Causes: history data unavailable, the SMA's WarmUpPeriod not matching its period, or WarmUpIndicator not feeding history to built-in indicators.","commonSituations":"History data for SPY minute bars missing before StartDate, a LEAN version change that broke SimpleMovingAverage's IIndicatorWarmUpPeriodProvider implementation, or WarmUpIndicator not resolving the WarmUpPeriod for built-in indicators correctly.","solutions":["Verify that SimpleMovingAverage implements IIndicatorWarmUpPeriodProvider and its WarmUpPeriod equals the constructor period (60).","Confirm minute history data exists for at least 60 bars before SetStartDate.","Trace WarmUpIndicator to ensure it treats built-in indicators the same as custom ones.","If testing engine changes, check that IndicatorBase.WarmUpPeriod is properly set for SimpleMovingAverage."],"exampleFix":"// before — if SMA doesn't set WarmUpPeriod\npublic class SimpleMovingAverage : Indicator, IIndicatorWarmUpPeriodProvider\n{\n    // WarmUpPeriod not set, defaults to 0, warm-up does nothing\n}\n\n// after\npublic class SimpleMovingAverage : Indicator, IIndicatorWarmUpPeriodProvider\n{\n    public int WarmUpPeriod => Period; // ensures warm-up feeds 'Period' bars\n}","handlingStrategy":"validation","validationCode":"// Validate built-in indicator warm-up\nWarmUpIndicator(\"SPY\", _customNotInherit, Resolution.Minute);\nif (!_customNotInherit.IsReady)\n    Log($\"SMA not ready after warm-up. Samples: {_customNotInherit.Samples}, WarmUpPeriod: {((IIndicatorWarmUpPeriodProvider)_customNotInherit).WarmUpPeriod}\");","typeGuard":"bool IndicatorSupportsWarmUp(IndicatorBase indicator)\n{\n    return indicator is IIndicatorWarmUpPeriodProvider provider && provider.WarmUpPeriod > 0;\n}","tryCatchPattern":null,"preventionTips":["Verify that built-in indicators (SimpleMovingAverage, etc.) implement IIndicatorWarmUpPeriodProvider with WarmUpPeriod == Period.","Ensure history data exists for at least the indicator's period before StartDate.","Call RegisterIndicator before WarmUpIndicator so the symbol and resolution context is established."],"tags":["quantconnect","lean","indicator","sma","warmup","builtin","regression-test"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}