QuantConnect/Lean · error · RegressionTestException
_customWarmUp indicator was expected to be ready
Error message
_customWarmUp indicator was expected to be ready
What it means
This RegressionTestException is thrown in Initialize after WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute). It asserts that the custom indicator _customWarmUp (a CSMAWithWarmUp implementing IIndicatorWarmUpPeriodProvider) is ready. LEAN throws it to verify that WarmUpIndicator successfully feeds historical data to indicators that declare a WarmUpPeriod, bringing them to IsReady == true before live data begins.
Source
Thrown at Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs:62
_customWarmUp = new CSMAWithWarmUp("_customWarmUp", 60);
_customNotInherit = new SimpleMovingAverage("_customNotInherit", 60);
// using 2nd SMA to match counterpart python algorithm ( CustomSMA + csharpIndicator )
// so that AlgorithmHistoryDataPoints are the same in both
_duplicateSMA = new SimpleMovingAverage("_duplicateSMA", 60);
// Register the daily data of "SPY" to automatically update both indicators
RegisterIndicator("SPY", _customWarmUp, Resolution.Minute);
RegisterIndicator("SPY", _customNotWarmUp, Resolution.Minute);
RegisterIndicator("SPY", _customNotInherit, Resolution.Minute);
RegisterIndicator("SPY", _duplicateSMA, Resolution.Minute);
// Warm up _customWarmUp indicator
WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute);
// Check _customWarmUp indicator has already been warmed up with the requested data
if (!_customWarmUp.IsReady)
{
throw new RegressionTestException("_customWarmUp indicator was expected to be ready");
}
if (_customWarmUp.Samples != 60)
{
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 dataView on GitHub (pinned to d2c3659f87)
Solutions
- Verify that minute-resolution history data exists for at least 60 bars before SetStartDate for SPY.
- Check that CSMAWithWarmUp.WarmUpPeriod returns 60 and IIndicatorWarmUpPeriodProvider is properly implemented.
- Trace WarmUpIndicator execution to confirm it retrieves history and feeds each bar to the indicator.
- If testing engine changes, verify the history provider delivers the correct number of bars for the warm-up period.
Example fix
// before — custom indicator must implement IIndicatorWarmUpPeriodProvider for WarmUpIndicator to work
private class CSMANotWarmUp : IndicatorBase<IBaseData>
{
public override bool IsReady => _queue.Count == _period;
// no WarmUpPeriod — WarmUpIndicator skips this
}
// after — implement the interface
private class CSMAWithWarmUp : CSMANotWarmUp, IIndicatorWarmUpPeriodProvider
{
public CSMAWithWarmUp(string name, int period) : base(name, period)
{
WarmUpPeriod = period; // 60
}
public int WarmUpPeriod { get; }
} Defensive patterns
Strategy: validation
Validate before calling
// Validate warm-up readiness before asserting
WarmUpIndicator("SPY", _customWarmUp, Resolution.Minute);
if (!_customWarmUp.IsReady)
Log($"_customWarmUp not ready after warm-up. Samples: {_customWarmUp.Samples}, WarmUpPeriod: {((IIndicatorWarmUpPeriodProvider)_customWarmUp).WarmUpPeriod}"); Type guard
// Check if an indicator supports warm-up before calling WarmUpIndicator bool SupportsWarmUp(IndicatorBase indicator) => indicator is IIndicatorWarmUpPeriodProvider;
Prevention
- Ensure custom indicators implement IIndicatorWarmUpPeriodProvider with WarmUpPeriod set to the indicator period.
- Verify history data exists for at least WarmUpPeriod bars before StartDate.
- Register the indicator with RegisterIndicator before calling WarmUpIndicator so the symbol resolution is known.
When it happens
Trigger: _customWarmUp.IsReady is false after WarmUpIndicator. This means the warm-up process did not feed enough data points (60) to the indicator. Causes include: history data unavailable, WarmUpPeriod not read correctly, or the warm-up loop not executing the expected number of iterations.
Common situations: History data for SPY minute bars is missing or insufficient for the warm-up window (60 minutes before StartDate), a LEAN version change to WarmUpIndicator or history retrieval broke the data feeding, or IIndicatorWarmUpPeriodProvider.WarmUpPeriod is not being read by the warm-up engine.
Related errors
- _customWarmUp indicator was expected to have processed 60 da
- _customNotInherit indicator was expected to have processed 6
- _customNotWarmUp indicator wasn't expected to be warmed up
- _customNotInherit indicator was expected to be ready
- _duplicateSMA indicator was expected to be ready
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/51485a33bb68045a.
Report an issue: GitHub.