Expected Behavior
WarmUpPeriod is the number of data points an indicator needs before IsReady turns true.
Actual Behavior
McClellanOscillator reports 41 and is ready on bar 40. McClellanSummationIndex delegates
WarmUpPeriod to it and reports the same.
WarmUpPeriod => EMASlow.WarmUpPeriod + ADDifference.WarmUpPeriod // 39 + 2 = 41
IsReady => EMASlow.IsReady
EMASlow is ADDifference.EMA(slowPeriod), and IndicatorExtensions.EMA passes
waitForFirstToReady = true, so EMASlow receives its first input on the bar ADDifference
becomes ready rather than the bar after it. The two periods share that bar, and adding them
counts it twice.
Potential Solution
EMASlow.WarmUpPeriod + ADDifference.WarmUpPeriod - 1. That changes no value the indicator
reports: at 40 bars the oscillator is 0 and the summation index is 60, the same as at 41, and
Samples is WarmUpPeriod * 3 either way.
Reproducing the Problem
var indicator = new McClellanOscillator(19, 39);
indicator.Add(Symbols.AAPL);
indicator.Add(Symbols.MSFT);
indicator.Add(Symbols.GOOG);
var reference = DateTime.Today;
for (var i = 1; i <= indicator.WarmUpPeriod - 1; i++)
{
indicator.Update(new TradeBar { Symbol = Symbols.AAPL, Close = i, Volume = 1, Time = reference.AddMinutes(i) });
indicator.Update(new TradeBar { Symbol = Symbols.MSFT, Close = i, Volume = 1, Time = reference.AddMinutes(i) });
indicator.Update(new TradeBar { Symbol = Symbols.GOOG, Close = i, Volume = 1, Time = reference.AddMinutes(i) });
}
Console.WriteLine(indicator.IsReady); // True, one bar before WarmUpPeriod
Both fixtures override WarmsUpProperly and assert IsTrue(IsReady) after WarmUpPeriod
bars without asserting it was false before, so being ready early passes.
System Information
master at d865a40.
Checklist
Expected Behavior
WarmUpPeriodis the number of data points an indicator needs beforeIsReadyturns true.Actual Behavior
McClellanOscillatorreports 41 and is ready on bar 40.McClellanSummationIndexdelegatesWarmUpPeriodto it and reports the same.EMASlowisADDifference.EMA(slowPeriod), andIndicatorExtensions.EMApasseswaitForFirstToReady = true, soEMASlowreceives its first input on the barADDifferencebecomes ready rather than the bar after it. The two periods share that bar, and adding them
counts it twice.
Potential Solution
EMASlow.WarmUpPeriod + ADDifference.WarmUpPeriod - 1. That changes no value the indicatorreports: at 40 bars the oscillator is 0 and the summation index is 60, the same as at 41, and
SamplesisWarmUpPeriod * 3either way.Reproducing the Problem
Both fixtures override
WarmsUpProperlyand assertIsTrue(IsReady)afterWarmUpPeriodbars without asserting it was false before, so being ready early passes.
System Information
master at d865a40.
Checklist
masterbranch