A test case is attached: I have gotten 5% false positive results: some magic APPEARED to happen when I commented some of the lines out of Initialize (such as COBC); but in any case, the following output is from my console (it has happened both on a live connection and on the Replay):
lastBackFillBar=290015
Finish BackFill[1] Volume = 6258
Plot(): CurrentBar=290015 BarsInProgress=1 BarsArray[1].Disposed=True backFill=False
ALSO: this ONLY has happened for me on non-minute bar types: the above was printed from a Point And Figure [1, 1, 3] on 6E 06-14 (the primary series). On a 5 minute chart w/ the same instrument, the error has NEVER appeared.
FURTHER: I was tipped by the debugger catching an early index range exception (below): this paring-out of my code is intended to back-fill the chart using the series added in Init: once backfill is complete, the series is disposed. On the minute charts, NT will iterate BarUpdate for every 'historical' bar in BOTH series' before passing anything to Plot. However, on the non-minute types (it also happens on volume, range, etc) NT actually will pass the last 1-2 'historical' bars of the added series to Plot (and I was not checking BarsInProgress since I dispose of the series) and my code would try accessing ChartControl.GetYByValue assuming this was a non-historical bar (and I also assumed series 0, but that in fact wouldn't matter: it's the fact then the series is actually disposed, and on this exact method the index exception would rise) -- the line raising this exception is present in the test case, and you should be able to trap that.
The above exception:
A first chance exception of type 'System.IndexOutOfRangeException' occurred in NinjaTrader.Core.dll
An exception of type 'System.IndexOutOfRangeException' occurred in NinjaTrader.Core.dll but was not handled in user code
Additional information: Index was outside the bounds of the array.
2014-05-18 19:33:00:627 ERROR: Error on plotting indicator 'MarketDataTest'. Please check the 'OnBarUpdate' or the 'Plot' method: Index was outside the bounds of the array.
Comment