QuantConnect/Lean · error · RegressionTestException
_duplicateSMA indicator was expected to have processed 60 da
Error message
_duplicateSMA indicator was expected to have processed 60 datapoints already
What it means
Thrown after WarmUpIndicator is called on a SimpleMovingAverage (_duplicateSMA, period 60) registered to SPY minute data. The regression asserts the indicator consumed exactly 60 historical samples during warm-up. A mismatch means Lean's warm-up subsystem did not feed the expected number of historical data points into the indicator before the live algorithm loop began.
Source
Thrown at Algorithm.CSharp/CustomWarmUpPeriodIndicatorAlgorithm.cs:98
// 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");
}
}
public override void OnData(Slice slice)
{
if (!Portfolio.Invested)
{
SetHoldings("SPY", 1);
}
if (Time.Second == 0)
{
// Compute the difference between the indicators values
var diff = Math.Abs(_customNotWarmUp.Current.Value - _customWarmUp.Current.Value);
diff += Math.Abs(_customNotInherit.Current.Value - _customNotWarmUp.Current.Value);
diff += Math.Abs(_customNotInherit.Current.Value - _customWarmUp.Current.Value);
diff += Math.Abs(_duplicateSMA.Current.Value - _customWarmUp.Current.Value);
diff += Math.Abs(_duplicateSMA.Current.Value - _customNotWarmUp.Current.Value);View on GitHub (pinned to d2c3659f87)
Solutions
- Verify at least 60 minute bars of SPY history exist before SetStartDate in the data feed / object store.
- Ensure the indicator's WarmUpPeriod (or period for built-in indicators) is set to 60 and matches the resolution used in WarmUpIndicator.
- Confirm RegisterIndicator was called before WarmUpIndicator so the consolidator wiring is in place.
- Check for duplicate WarmUpIndicator calls on the same symbol that could double-count or skip samples.
Example fix
// before
WarmUpIndicator("SPY", _duplicateSMA, Resolution.Minute);
if (_duplicateSMA.Samples != 60) { throw ...; }
// after — assert readiness and log actual sample count for diagnosis
WarmUpIndicator("SPY", _duplicateSMA, Resolution.Minute);
if (_duplicateSMA.Samples != 60)
{
throw new RegressionTestException($"_duplicateSMA processed {_duplicateSMA.Samples}, expected 60");
} Defensive patterns
Strategy: validation
Validate before calling
// Before relying on the indicator, validate warm-up produced the expected samples
WarmUpIndicator("SPY", _duplicateSMA, Resolution.Minute);
if (!_duplicateSMA.IsReady || _duplicateSMA.Samples < 60)
{
throw new InvalidOperationException(
$"Warm-up incomplete: IsReady={_duplicateSMA.IsReady}, Samples={_duplicateSMA.Samples}");
} Prevention
- Always call RegisterIndicator before WarmUpIndicator so the consolidator is wired.
- Confirm the data feed has at least [period] bars before the algorithm start date.
- Use indicators whose WarmUpPeriod matches their period for predictable sample counts.
When it happens
Trigger: Calling WarmUpIndicator("SPY", indicator, Resolution.Minute) on a period-60 SMA and then checking indicator.Samples != 60. The check fires when the warm-up history request returns fewer/more points than the indicator period, or when the indicator was already partially populated before warm-up.
Common situations: Insufficient historical data for SPY minute bars before the algorithm start date (2013-10-07), a custom indicator that does not implement IIndicatorWarmUpPeriodProvider, a changed WarmUpPeriod property, or a Lean version change that altered how RegisterIndicator + WarmUpIndicator interact (duplicate registrations of the same symbol/indicator pair).
Related errors
- _customNotInherit indicator was expected to be ready
- _customNotInherit indicator was expected to have processed 6
- _duplicateSMA indicator was expected to be ready
- _customWarmUp indicator was expected to be ready
- _customWarmUp indicator was expected to have processed 60 da
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/d5de71bcfda9ddf9.
Report an issue: GitHub.