private Series<double> test;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Indicator here.";
Name = "DateTest";
Calculate = Calculate.OnEachTick;
IsOverlay = false;
DisplayInDataBox = true;
DrawOnPricePanel = true;
DrawHorizontalGridLines = true;
DrawVerticalGridLines = true;
PaintPriceMarkers = true;
ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
IsSuspendedWhileInactive = true;
}
else if (State == State.Configure)
{
AddDataSeries("ES 03-19", BarsPeriodType.Tick, 1);
}
else if (State == State.DataLoaded)
{
test = new Series<double>(BarsArray[0]);
}
}
protected override void OnBarUpdate()
{
//if the secondary series is not loaded yet, return
if(CurrentBars[1] == -1) {
return;
}else{
test[0] = Closes[1][0]
}
}
Indicator 'DateTest': Error on calling 'OnBarUpdate' method on bar -1: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
if(CurrentBars[0] == -1) return

Comment