When I configure my chart data series to 'Load data based on' Bars vs Days, my indicator(s) using AddDataSeries throw exceptions in when setting plot Values or ISeries.
The AddDataSeries has to use a larger BarsPeriod.Value than the primary series. When primary series is configured to 'Load data based on' Days, everything seems to work normally with no exceptions.
EXCEPTION [MultiSeriesTest]: OnBarUpdate; BIP: 1; CB1: 0, 1/26/2024 2:45:00 AM; CB2: 0, 1/26/2024 2:45:00 AM; Ct1: 50; Ct2: 50; ADS: True Msg: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Trace: at System.ThrowHelper.ThrowArgumentOutOfRangeExceptio n(ExceptionArgument argument, ExceptionResource resource)
at NinjaTrader.NinjaScript.Series`1.set_Item(Int32 barsAgo, T value)
at NinjaTrader.NinjaScript.Indicators.MultiSeriesTest .OnBarUpdate() in c:\Users\becht\Documents\NinjaTrader 8\bin\Custom\Indicators\CDX\Indicators\MultiSeries Test.cs:line 117
Please see the attached MultiSeriesTest.cs script as an example, setting the Alternate Data Series to something larger than the primary.
This appears to be a synchronization bug between the two data series when using Load data based on Bars. Am I missing something?
Thanks in advance.
Comment