Hello,

In getting acclimated to QC and Lean I am trying to make sure that I am going about things efficently and as intended. In looking at the MovingAverageConvergenceDivergence indicator class, it looks like the consturctors set the indicator WarmUpPeriod = provided signal period as seen below. 

public MovingAverageConvergenceDivergence(int fastPeriod, int slowPeriod, int signalPeriod, MovingAverageType type = MovingAverageType.Exponential) : this($"MACD({fastPeriod},{slowPeriod},{signalPeriod})", fastPeriod, slowPeriod, signalPeriod, type) { } public MovingAverageConvergenceDivergence(string name, int fastPeriod, int slowPeriod, int signalPeriod, MovingAverageType type = MovingAverageType.Exponential) : base(name) { Fast = type.AsIndicator(name + "_Fast", fastPeriod); Slow = type.AsIndicator(name + "_Slow", slowPeriod); Signal = type.AsIndicator(name + "_Signal", signalPeriod); Histogram = new Identity(name + "_Histogram"); WarmUpPeriod = signalPeriod; }

In my experiance working with other quanitative strategies, I would expect this indicator to not be "Ready" untill enough data have been pumped into the indicator that is equal to the greatest value of 'fastPeriod', 'slowPeriod', and 'signalPeriod'. So I would expect that the WarmUpPeriod for the default MACD values (12, 26, 9) would be 26 and not 9 as it currently is. I would expect the constructor to set the WarmUpPeriod as something like this to get the largest of the values: 

public MovingAverageConvergenceDivergence(string name, int fastPeriod, int slowPeriod, int signalPeriod, MovingAverageType type = MovingAverageType.Exponential) : base(name) { Fast = type.AsIndicator(name + "_Fast", fastPeriod); Slow = type.AsIndicator(name + "_Slow", slowPeriod); Signal = type.AsIndicator(name + "_Signal", signalPeriod); Histogram = new Identity(name + "_Histogram"); WarmUpPeriod = Math.Max(fastPeriod, Math.Max(slowPeriod, signalPeriod)); }

 

I know that I can set the algorithm warm up period manually, or manually handle indicator data, or I could create my own MACD indicator to handle this how I would expect. However, all of these seem cumbersome to do especcially when using custom data and data custom data consolidators for something so commonly used with indicators. 

I guess my question is, is this the intended behavior for the MACD indicator? And if so is there a less cumbersome way to update the indicator warmup period with custom consolidated data?

 

Thank you,

Author