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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
571 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
549 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment