{"record":{"id":"fdae7f93b395f402","repo":"QuantConnect/Lean","slug":"indicators-are-not-ready-fdae7f","errorCode":null,"errorMessage":"Indicators are not ready!","messagePattern":"Indicators are not ready!","errorType":"exception","errorClass":"RegressionTestException","httpStatus":null,"severity":"error","filePath":"Algorithm.CSharp/BasicTemplateIndexOptionsAlgorithm.cs","lineNumber":134,"sourceCode":"        {\n            return QuantConnect.Symbol.CreateOption(\n                symbol.Underlying,\n                symbol.ID.Market,\n                symbol.ID.OptionStyle,\n                symbol.ID.OptionRight == OptionRight.Call ? OptionRight.Put : OptionRight.Call,\n                symbol.ID.StrikePrice,\n                symbol.ID.Date);\n        }\n\n        /// <summary>\n        /// Asserts indicators are ready\n        /// </summary>\n        /// <exception cref=\"RegressionTestException\"></exception>\n        protected void AssertIndicators()\n        {\n            if (!_emaSlow.IsReady || !_emaFast.IsReady)\n            {\n                throw new RegressionTestException(\"Indicators are not ready!\");\n            }\n        }\n\n        /// <summary>\n        /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.\n        /// </summary>\n        public virtual bool CanRunLocally { get; } = false;\n\n        /// <summary>\n        /// This is used by the regression test system to indicate which languages this algorithm is written in.\n        /// </summary>\n        public virtual List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };\n\n        /// <summary>\n        /// Data Points count of all timeslices of algorithm\n        /// </summary>\n        public virtual long DataPoints => 0;\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.CSharp/BasicTemplateIndexOptionsAlgorithm.cs#L116-L152","documentation":"Same AssertIndicators() pattern as error 20, but in BasicTemplateIndexOptionsAlgorithm. Thrown when _emaSlow (period 80, Minute) or _emaFast (period 200, Minute) did not reach IsReady by OnEndOfAlgorithm. The EMA indicators must accumulate their full period of SPX data samples.","triggerScenarios":"The date range is too short for 200 minute bars, SPX data is missing so EMA updates never occur, or the OnData gate checking slice.Bars.ContainsKey(_spx) blocks all updates.","commonSituations":"Date range modifications that shorten the backtest below the indicator warmup threshold, data feed issues with SPX index data, or changes to EMA construction parameters.","solutions":["Extend the backtest start date to provide at least 200 minute-resolution SPX bars.","Add SetWarmUp(200, Resolution.Minute) in Initialize to pre-fill indicators.","Verify SPX data files exist for the full configured date range.","Debug-log _emaSlow.Samples and _emaFast.Samples to identify the deficit."],"exampleFix":"// before\n_emaSlow = EMA(_spx, 80);\n_emaFast = EMA(_spx, 200);\n\n// after\n_emaSlow = EMA(_spx, 80);\n_emaFast = EMA(_spx, 200);\nSetWarmUp(200, Resolution.Minute);","handlingStrategy":"validation","validationCode":"// Check indicator warmup before asserting\nif (_emaSlow.Samples < _emaSlow.Period || _emaFast.Samples < _emaFast.Period)\n{\n    Log($\"Indicator warmup incomplete: slow={_emaSlow.Samples}/{_emaSlow.Period}, \" +\n        $\"fast={_emaFast.Samples}/{_emaFast.Period}\");\n}","typeGuard":"bool AreIndicatorsReady() => _emaSlow.IsReady && _emaFast.IsReady;","tryCatchPattern":null,"preventionTips":["Call SetWarmUp(maxPeriod, Resolution) in Initialize.","Ensure SPX data files cover the full warmup + trading window.","Gate OnData trading logic behind indicator IsReady checks.","Log indicator sample counts in OnEndOfAlgorithm for diagnosis."],"tags":["quantconnect","indicators","ema","warmup","options","regression-test"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}