/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (CurrentBar < 1) { OscillatorLine.Set(0); SignalLine.Set(0); Oscillator.Set(0); return; } oscillatorValue = fastSMA[0] - slowSMA[0]; if (ShowLines) { OscillatorLine.Set(oscillatorValue); SignalLine.Set(SMA(OscillatorLine, Smooth)[0]); } else { OscillatorLine.Reset(); SignalLine.Reset(); } Oscillator.Set(oscillatorValue); if (Rising(Oscillator)) { PlotColors[0][0] = UpColor; PlotColors[2][0] = UpColor; } else { PlotColors[0][0] = DownColor; PlotColors[2][0] = DownColor; } }