I receive an exception in the following scenario:
- I am connnected to NinjaTrader Continuum.
- I open an existing workspace that has 4 windows open with a total of 6 charts.
- There are two charts that have my indicator running.
- During the initial load of the chart the exception below is received once.
(My indicator catches this exception in the OnBarUpdate method when calling
Draw.TriangleUp (or Down).
The line of code that bombs:
if (CurrentBar == 0) return; .... Draw.TriangleDown(this, CurrentBar.ToString(), true, 0, High[0], Brushes.Red);
System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.Max(IEnumerable`1 source) at NinjaTrader.Gui.Chart.ChartControl.get_PanelWidthPixels() at NinjaTrader.Gui.Chart.ChartControl.get_CanvasRight() at NinjaTrader.Gui.Chart.ChartControl.GetXBySlotIndex(Double slotIndex) at NinjaTrader.Gui.Chart.ChartControl.GetXByBarIndex(ChartBars chartBars, Int32 barIndex) at NinjaTrader.NinjaScript.DrawingTools.DrawingTool.CreateChartAnchor(NinjaScriptBase ownerNinjaScript, Int32 barsAgo, DateTime time, Double y) at NinjaTrader.NinjaScript.DrawingTools.Draw.ChartMarkerCore[T](NinjaScriptBase owner, String tag, Boolean isAutoScale, Int32 barsAgo, DateTime time, Double yVal, Brush brush, Boolean isGlobal, String templateName) at NinjaTrader.NinjaScript.DrawingTools.Draw.TriangleUp(NinjaScriptBase owner, String tag, Boolean isAutoScale, Int32 barsAgo, Double y, Brush brush) at NinjaTrader.NinjaScript.Indicators.GRenkoTail.OnBarUpdate()
Thanks,
Gary
Comment