This is the PPO indicator code:
public class PPO : Indicator { private EMA emaFast; private EMA emaSlow; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionPPO; Name = NinjaTrader.Custom.Resource.NinjaScriptIndicatorNamePPO; IsSuspendedWhileInactive = true; Fast = 12; Slow = 26; Smooth = 9; AddPlot(Brushes.DimGray, NinjaTrader.Custom.Resource.NinjaScriptIndicatorDefault); AddPlot(Brushes.Crimson, NinjaTrader.Custom.Resource.PPOSmoothed); AddLine(Brushes.DarkGray, 0, NinjaTrader.Custom.Resource.NinjaScriptIndicatorZeroLine); } else if (State == State.DataLoaded) { emaFast = EMA(Fast); emaSlow = EMA(Slow); } } protected override void OnBarUpdate() { double emaSlow0 = emaSlow[0]; Default[0] = 100 * ((emaFast[0] - emaSlow0) / emaSlow0); Smoothed[0] = EMA(Values[0], Smooth)[0]; }
AddPlot(new Stroke(Brushes.DodgerBlue, 2), PlotStyle.Bar, NinjaTrader.Custom.Resource.NinjaScriptIndicatorDiff);
Comment