PDA

View Full Version : Index out of Range DrawRectangle


gg80108
04-01-2009, 10:53 AM
I downloaded the SampleDrawObject code and applied to my chart, looked good.
I copied and pasted the:
DrawRectangle("Rectangle", rectWidth, Close[rectWidth], 0, Close[0], Color.Blue, Color.BlueViolet, 5); into another indicator that was already running at the chart on the chart but receive the following.

Error on calling the 'OnBarUpdate' method for indicator 'ScalperCopy' on bar 7: Index was out of range. Must be non-negative and less than the size of the collection.

NinjaTrader_Bertrand
04-01-2009, 11:05 AM
Hi, can you please post the full code of your modification? Most likely you didn't copy the uptrend counter from the sample...

NinjaTrader_Bertrand
04-01-2009, 01:07 PM
This would affect startBarAgo and the startY value. Please post your code so we can review it - Thanks!