After adding ticks dataseries in the OnStateChange method we get the exception listed below. It is happening only while loading the chart.
In OnStateChanged we add the dataseries using the following line:
AddDataSeries(BarsPeriodType.Tick, 1);
We test this in replay mode. It is working on two PCs but on the third PC we get data out of the range of the chart, and this is why it is throwing the exception below.
It is strange that if we use 32 days back chart it is not throwing the exception, but if we are using 30 days back chart we get the exception... While the 32 days chart has more bars than the 30 days chart.
I want to note that we have tick replay data for 3 days back, all other 27 days are loaded historically (for them we do not have tick data in the NT8 DB)
I am suspecting that this is DB/data issue, but decided to ask you and to see what you will suggest
P.S.
Even if we delete the tick replay data and download it again, the exception continues to exist.
I get the current tick/bar closing price using - Closes[1][0]
Two lines after that I am getting the prior tick bar close using
if (p > Closes[1][1]) {...}
and here it is the place where I get the exception. What is worrying me is that on one of the computers we get the following exception (on the other two test PCs we do not have this issue)
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeExceptio n(ExceptionArgument argument, ExceptionResource resource)
at NinjaTrader.Data.BarsSeries.GetOpen(Int32 index)
at NinjaTrader.Data.BarsSeries.GetClose(Int32 index)
at NinjaTrader.Data.Bars.GetClose(Int32 index)
at NinjaTrader.NinjaScript.PriceSeries.get_Item(Int32 barsAgo)
at NinjaTrader.NinjaScript.Indicators.DValueAreaFinal _NoUI.OnBarUpdate() in c:\Users\abubi\Documents\NinjaTrader 8\bin\Custom\Indicators\DValueAreaFinal_NoUI.cs:li ne 1374
Comment