"Indicator 'IndicatorName': Error on calling 'EventHandlerMarketData' method: Index was outside the bounds of the array."
//This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class IndicatorName : Indicator { protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @""; Name = "IndicatorName"; Calculate = Calculate.OnEachTick; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //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; AddPlot(Brushes.DodgerBlue, "Difference"); AddLine(Brushes.DarkGray, 0, "ZeroLine"); } else if (State == State.Configure) { AddDataSeries(Data.BarsPeriodType.Tick, 1); } else if (State == State.DataLoaded) { } } protected override void OnMarketData(MarketDataEventArgs e) { //logic } protected override void OnBarUpdate() { if (CurrentBars[0] < 12 || CurrentBars[1] < 12) return; //logic } [I][B][/B][/I]
Comment