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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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
-
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.
-
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
-
Originally 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
-
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 llanqui, Today, 12:51 PM
|
1 response
3 views
0 likes
|
Last Post Today, 12:55 PM | ||
Started by llanqui, Today, 11:13 AM
|
6 responses
11 views
0 likes
|
Last Post
by llanqui
Today, 12:52 PM
|
||
Decrease the size of the RegionHIghLightY on each tick when the price touches it
by cmtjoancolmenero
Started by cmtjoancolmenero, 04-29-2024, 03:40 PM
|
23 responses
70 views
0 likes
|
Last Post Today, 12:58 PM | ||
Started by reynoldsn, Yesterday, 04:40 PM
|
3 responses
13 views
0 likes
|
Last Post Today, 12:58 PM | ||
Started by i2ogu3, Yesterday, 11:31 PM
|
2 responses
20 views
0 likes
|
Last Post
by i2ogu3
Today, 12:37 PM
|
Comment