QuantConnect/Lean · error · RegressionTestException

_customNotInherit indicator was expected to be ready

Error message

_customNotInherit indicator was expected to be ready

What it means

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.

Source

Thrown at Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs:83

            {
                throw new RegressionTestException("_customWarmUp indicator was expected to have processed 60 datapoints already");
            }

            // Try to warm up _customNotWarmUp indicator. It's expected from LEAN to skip the warm up process
            // because this indicator doesn't implement IIndicatorWarmUpPeriodProvider
            WarmUpIndicator("SPY", _customNotWarmUp, Resolution.Minute);

            // Check _customNotWarmUp indicator is not ready, because the warm up process was skipped
            if (_customNotWarmUp.IsReady)
            {
                throw new RegressionTestException("_customNotWarmUp indicator wasn't expected to be warmed up");
            }

            WarmUpIndicator("SPY", _customNotInherit, Resolution.Minute);
            // Check _customWarmUp indicator has already been warmed up with the requested data
            if (!_customNotInherit.IsReady)
            {
                throw new RegressionTestException("_customNotInherit indicator was expected to be ready");
            }
            if (_customNotInherit.Samples != 60)
            {
                throw new RegressionTestException("_customNotInherit indicator was expected to have processed 60 datapoints already");
            }

            WarmUpIndicator("SPY", _duplicateSMA, Resolution.Minute);
            // Check _customWarmUp indicator has already been warmed up with the requested data
            if (!_duplicateSMA.IsReady)
            {
                throw new RegressionTestException("_duplicateSMA indicator was expected to be ready");
            }
            if (_duplicateSMA.Samples != 60)
            {
                throw new RegressionTestException("_duplicateSMA indicator was expected to have processed 60 datapoints already");
            }
        }

View on GitHub (pinned to d2c3659f87)

Solutions

  1. Verify that SimpleMovingAverage implements IIndicatorWarmUpPeriodProvider and its WarmUpPeriod equals the constructor period (60).
  2. Confirm minute history data exists for at least 60 bars before SetStartDate.
  3. Trace WarmUpIndicator to ensure it treats built-in indicators the same as custom ones.
  4. If testing engine changes, check that IndicatorBase.WarmUpPeriod is properly set for SimpleMovingAverage.

Example fix

// before — if SMA doesn't set WarmUpPeriod
public class SimpleMovingAverage : Indicator, IIndicatorWarmUpPeriodProvider
{
    // WarmUpPeriod not set, defaults to 0, warm-up does nothing
}

// after
public class SimpleMovingAverage : Indicator, IIndicatorWarmUpPeriodProvider
{
    public int WarmUpPeriod => Period; // ensures warm-up feeds 'Period' bars
}
Defensive patterns

Strategy: validation

Validate before calling

// Validate built-in indicator warm-up
WarmUpIndicator("SPY", _customNotInherit, Resolution.Minute);
if (!_customNotInherit.IsReady)
    Log($"SMA not ready after warm-up. Samples: {_customNotInherit.Samples}, WarmUpPeriod: {((IIndicatorWarmUpPeriodProvider)_customNotInherit).WarmUpPeriod}");

Type guard

bool IndicatorSupportsWarmUp(IndicatorBase indicator)
{
    return indicator is IIndicatorWarmUpPeriodProvider provider && provider.WarmUpPeriod > 0;
}

Prevention

When it happens

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

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

Related errors


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