The attached example code demonstrates use of Draw.Line() from OnBarUpdate and from the ChartControl_PreviewMouseLeftButtonDown event.
Calling Draw.Line() from inside the mouse event generates the error "Index was out of range, Must be non-negative and less than the size of the collection." However, Draw.Line() works OK from non-event code like OnBarUpdate. I have tried wrapping the call inside its own ChartControl dispatcher in case there was a threading issue, but the error persists.
This is identical to a problem reported by another user for the NT8 beta (http://ww.ninjatrader.com/support/fo...d.php?p=453711).
Is there a solution or work-around? I want to draw a line in response to the user's mouse click on a specified price on the chart. Oddly, this code used to work, but has recently begun generating the above error.
Thank you.
Comment