9/25/2012 11:46:00 PM Strategy Error on calling 'OnBarUpdate' method for strategy 'XXX/2eb771a987a04bf6a26e80b69e17003e': Index was outside the bounds of the array.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
I dont see where is the Error
Collapse
X
-
I dont see where is the Error
What does this error mean and how do I fix it?
9/25/2012 11:46:00 PM Strategy Error on calling 'OnBarUpdate' method for strategy 'XXX/2eb771a987a04bf6a26e80b69e17003e': Index was outside the bounds of the array.Tags: None
-
Reads like you are trying to access a bar that does not yet exist, but nobody can really say until we see more of the code that is throwing the problem.Originally posted by urbmiranda View PostWhat does this error mean and how do I fix it?
9/25/2012 11:46:00 PM Strategy Error on calling 'OnBarUpdate' method for strategy 'XXX/2eb771a987a04bf6a26e80b69e17003e': Index was outside the bounds of the array.
-
That means that you're accessing a bar that doesn't exist on the chart. For example,Originally posted by urbmiranda View PostWhat does this error mean and how do I fix it?
9/25/2012 11:46:00 PM Strategy Error on calling 'OnBarUpdate' method for strategy 'XXX/2eb771a987a04bf6a26e80b69e17003e': Index was outside the bounds of the array.
if(Close[50] > 99.89)
{
//do something
}
In that example, the system tries to get the closing price of the bar 50 and on the chart there is only 10 bars so it will throw that kind of error.
Try this one
if(CurrentBar < 50) return;
That 50 is the number of bars.
Comment
-
Hi, I work with urbmiranda...
Inside Initalize() block there's the instruction:
Add(PeriodType.Week, 1)
which seems to be causing trouble.
This is what we did:
We started from scratch, copying the original's strategy code in a new script (we had several strategies together before, so we're trying to make sure no strategy is affecting another one).
That done, the error i get is as follows:
"
Error on calling 'OnBarUpdate' method for strategy 'XXXXX/094d24a9291d4d7ebaabf03dfa84fe59': You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceEntry() method in the context of a multi-time frame and instrument strategy.
"
Any suggestions?
Comment
-
Hello SebTr,
To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com
Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.
I look forward to assisting you further.
*The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.JoydeepNinjaTrader Customer Service
Comment
-
It means what it says. You created a multi-timeseries script, so you need to use the correct syntax. Here is what the online help says: http://www.ninjatrader.com/support/h...sinceentry.htmOriginally posted by SebTr View PostHi, I work with urbmiranda...
Inside Initalize() block there's the instruction:
Add(PeriodType.Week, 1)
which seems to be causing trouble.
This is what we did:
We started from scratch, copying the original's strategy code in a new script (we had several strategies together before, so we're trying to make sure no strategy is affecting another one).
That done, the error i get is as follows:
"
Error on calling 'OnBarUpdate' method for strategy 'XXXXX/094d24a9291d4d7ebaabf03dfa84fe59': You must use the overload that has a 'BarsInProgress' parameter when calling the BarsSinceEntry() method in the context of a multi-time frame and instrument strategy.
"
Any suggestions?
"The following method signature should be used when working with multi-time frame and instrument strategies:
BarsSinceEntry(int barsInProgressIndex, string signalName, int entriesAgo)"
Comment
-
Thanks everyone for your support so far.
The BarsSinceEntry() on multi-time frame issue is solved now. Thanks for your help.
We have another problem though: I get once again the error: 'Index was outside the bounds of the array'. Thing is I fail to find in the code where this error might be. I've looked carefully everywhere there's an instruction calling a bar, or data (like Open, Close or SMA functions, indicators, etc)... everything seems to be fine.
Is there any way I can get a more detailed error log? Or perhaps setting a 'stop point' inside my code, so i can run it line by line and test everything my code is doing?
Tks!
Comment
-
When I am at my wits end, I use this shotgun approach that I detailed in this thread. See if you might want to use it too.Originally posted by SebTr View PostThanks everyone for your support so far.
The BarsSinceEntry() on multi-time frame issue is solved now. Thanks for your help.
We have another problem though: I get once again the error: 'Index was outside the bounds of the array'. Thing is I fail to find in the code where this error might be. I've looked carefully everywhere there's an instruction calling a bar, or data (like Open, Close or SMA functions, indicators, etc)... everything seems to be fine.
Is there any way I can get a more detailed error log? Or perhaps setting a 'stop point' inside my code, so i can run it line by line and test everything my code is doing?
Tks!
Actually after reading that whole thread again, it turns out that the problem/error message we were dealing with is the same one that you have posted.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
656 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
371 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
579 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment