The AddChartIndicator help states
also is this code equal to the suggested code from help?
private SMA _sma; protected override void OnStateChange() { if (State == State.DataLoaded){ // Charts a 20 period simple moving average to the chart _sma = SMA(20); AddChartIndicator(_sma); } } protected override void OnBarUpdate() { // call SMA() historically to ensure the indicator processes its historical states as well double sma = _sma[0]; }
Comment