I wanted to develop average High and Low indicator over the past N period but I don't know what I did wrong that the plot value always returns 0. Please help.
Thank you very much.
protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"Average high of N bars ago"; Name = "AvgHigh"; Calculate = Calculate.OnPriceChange; IsOverlay = true; DisplayInDataBox = false; DrawOnPricePanel = true; DrawHorizontalGridLines = false; DrawVerticalGridLines = false; PaintPriceMarkers = false; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Overlay; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; Period = 3; AddPlot(Brushes.Orange, "AvgHigh"); } else if (State == State.Configure) { } } protected override void OnBarUpdate() { Value[0] = SMA(High, Period)[0]; }
Comment