To that effect, I created a simple indicator with a private DataSeries SS_State which was initialized this way (in Initialize()):
SS_State = new DataSeries(this, MaximumBarsLookBack.TwoHundredFiftySix);
Then, in OnBarUpdate(), I query the oldest value in SS_State:
Print("BAR# " + CurrentBar + " ; SS_State[SS_State.Count-1] = " + SS_State[SS_State.Count-1]);
This generates the following exception:
Exception BAR# 2546 : System.ArgumentException: barsAgo needed to be between 0 and 255 but was 2546
It turns out that SS_State.Count returns values up to CurrentBar, where I was expecting it to return values up to 256 (since that object was created with a max 256 bars LookBack.).
Is this a bug? If not, how can I assess the number of datapoints in a DataSeries object?
Thanks in advance

. NinjaTrader will automatically sync it to what the master indicator is that is hosting it. If the master is infinite then the secondary will be infinite and vice versa. If you need to define your own DataSeries object to store calculations then tt is not advisable to define your own hard coded lookback period as you want everything to match between the indicator/strategy and its hosted indicator so that you do not run into any strange issues. That may be the solution in the end for you is to not define your own Maximum bars look back. We have the same issue with users that manually set calculate on bar close and having on bar close on a primary be set to true and on a hosted be hard set to false and then you run into syncing issues.
Comment