NT Team,

I use the below (and attached) method extensively in Indicators with great success (e.g. High(GetBarsAgo(barNumber))). Indicators calculate and plot as expected.
Code:
namespace NinjaTrader.NinjaScript.Indicators
{
  public partial class Indicator
  {
    public int GetBarsAgo(int barNumber) 
    {
      return CurrentBar - barNumber;
    }
  }
}
However, when a Strategy is added to the chart, this method appears to result in exception of type 'System.ArgumentOutOfRangeException' in mscorlib.dll but was not handled in user code. It would appear, when a Strategy is added CurrentBar returns the BarNumber of the last BarNumber for every bar processed (e.g. if chart "Bars to load" = 1850 then CurrentBar = 1849). This logically returns the OutOfRange exception for any bar that is not the last bar.

This method worked as expected in NT7 with Indicators and Strategies.
Please advise how this method must change for NT8.

Regards
Shannon
Attached Files