Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Error on calling 'OnBarUpdate' method
Collapse
X
-
llstelle, I would suggest you look into adding try / catch standard C# exception handing to get a better understanding where your code needs modifications to address this issue - http://www.ninjatrader.com/support/f...ead.php?t=9825
-
You are accessing the Closes[1] barSeries. You need to check that barSeries too. Your current check, if (CurrentBar < 120), is on barSeries0.Originally posted by llstelle View PostHi, thanks for the link. I've found the part of the code where the bug exists:
I am "accessing an index with a value that is invalid since its out of range" when accessing the closing prices 119 bars ago for the other instrument. That's why I included:Code:for(int i=0; i<Y.Length; i++) { Y[i] = Closes[1][i]; SY += Closes[1][i]; }
It works perfectly fine for 1 year's backtest (1/1/2012 to 11/8/2012) but it doesn't seem to fix the problem on just 1 week (11/1/2012 to 11/8/2012) of data. Do you have an idea where is the problem?Code:if (CurrentBar < 120) return;
Thanks!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
173 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
328 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
252 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
354 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
181 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment