QuantConnect/Lean · error · RegressionTestException

Indicators are not ready!

Error message

Indicators are not ready!

What it means

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.

Solutions

  1. Extend the backtest start date to provide at least 200 minute-resolution SPX bars.
  2. Add SetWarmUp(200, Resolution.Minute) in Initialize to pre-fill indicators.
  3. Verify SPX data files exist for the full configured date range.
  4. Debug-log _emaSlow.Samples and _emaFast.Samples to identify the deficit.

Example fix

// before
_emaSlow = EMA(_spx, 80);
_emaFast = EMA(_spx, 200);

// after
_emaSlow = EMA(_spx, 80);
_emaFast = EMA(_spx, 200);
SetWarmUp(200, Resolution.Minute);
Defensive patterns

Strategy: validation

Validate before calling

// Check indicator warmup before asserting
if (_emaSlow.Samples < _emaSlow.Period || _emaFast.Samples < _emaFast.Period)
{
    Log($"Indicator warmup incomplete: slow={_emaSlow.Samples}/{_emaSlow.Period}, " +
        $"fast={_emaFast.Samples}/{_emaFast.Period}");
}

Type guard

bool AreIndicatorsReady() => _emaSlow.IsReady && _emaFast.IsReady;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13). Data as JSON: /api/errors/fdae7f93b395f402. Report an issue: GitHub.

Appendix: source

Thrown at Algorithm.CSharp/BasicTemplateIndexOptionsAlgorithm.cs:134

        {
            return QuantConnect.Symbol.CreateOption(
                symbol.Underlying,
                symbol.ID.Market,
                symbol.ID.OptionStyle,
                symbol.ID.OptionRight == OptionRight.Call ? OptionRight.Put : OptionRight.Call,
                symbol.ID.StrikePrice,
                symbol.ID.Date);
        }

        /// <summary>
        /// Asserts indicators are ready
        /// </summary>
        /// <exception cref="RegressionTestException"></exception>
        protected void AssertIndicators()
        {
            if (!_emaSlow.IsReady || !_emaFast.IsReady)
            {
                throw new RegressionTestException("Indicators are not ready!");
            }
        }

        /// <summary>
        /// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
        /// </summary>
        public virtual bool CanRunLocally { get; } = false;

        /// <summary>
        /// This is used by the regression test system to indicate which languages this algorithm is written in.
        /// </summary>
        public virtual List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };

        /// <summary>
        /// Data Points count of all timeslices of algorithm
        /// </summary>
        public virtual long DataPoints => 0;

View on GitHub (pinned to d2c3659f87)