Lets do one more example, though it's not matching 100% here.
Lets say I have a 60 minute chart that I am running your code on it.
60 minutes must pass before the first OnBarUpdate() call with BarsInProgress 0. After 60 minutes have passed from the beginning of your chart, you will get something like :
OBU call for 60 minute -> 1 element in the BarsArray[0] exists.
OBU call for 3 minute -> at least 20 elements in the BarsArray[1] exists.
OBU call for 5 minute -> at least 12 elements in the BarsArray[2] exists.
I am seeing that NinjaTrader is actually loading more than this for the second and third series, and I suspect there is some under-the-hood item where NinjaTrader is requesting additional historical data. I don't have a good explanation for this at this time other than perhaps it is being a bit over-careful to ensure that it has all the data it needs.
In this case all series are using "BarsRequired" equal to the same thing but with the under-the-hood handling of multi-series scripts NT is requesting additional historical data for the added series. At least this seems to be the case since I am seeing more than 20, and 12 elements respectively for the added series when I run your code.
If you need some set of series that are pegged closer to the OBU calls you could always track your own custom defined "BarsArray" and only assign values to it when you get the OBU calls.

Comment