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
Debugging Real-time Error
Collapse
X
-
Debugging Real-time Error
Hey guys I just started live testing a strategy against the SIM account and I'm getting an error, "You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart." How can I see which line is causing the error in real-time SIM account testing?Tags: None
-
Hi Elitetradernyc,
Thanks for posting.
The error you are receiving occurs because there are not enough bars on the chart or you are trying to access the Bars out the available range.
The link below is a great tip to check to see if you have enough bars in the data series you are accessing.
http://www.ninjatrader.com/support/f...ead.php?t=3170
When you run your code it check to make sure that there is enough bars to run the code. If there is not it will return and try again until there is.
As, for your second question there are some ways of checking real time errors that I would be happy to direct you to.
Please note that these methods can be a little more advanced and require using an external debugger such as visual studio which will allow you to step through code line by line. We do not officially support this debugging method but information on how this works can be found here: http://www.ninjatrader.com/support/h..._debugging.htm
Let me know if I can be of further assistance.Cal H.NinjaTrader Customer Service
-
Originally posted by elitetradernyc View PostHey guys I just started live testing a strategy against the SIM account and I'm getting an error, "You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart." How can I see which line is causing the error in real-time SIM account testing?
http://www.ninjatrader.com/support/f...45553#poststop
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
-
Hey guys i am currently using the CLR Debugger, and have it attached to the NT process, however for some reason it doesn't pick up the error in my real-time test, but it works just fine in the backtest. I need to find out which line is causing the error in real-time so that I can figure out how many bars I need for real-time versus backtest. How do I get the CLR debugger to catch the line causing it?
**NT** Error on calling 'OnBarUpdate' method for strategy 'TestHourly/6bca9ee0f8e9452aa85b85359246dc2d': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
Comment
-
Hi Elitetradernyc,
While we do not support the CLR debugging tool, there is a forum thread about how to use this in your debugging process from another forum user.
http://www.ninjatrader.com/support/f...ad.php?t=16977
There is also a thread on debugging your code without having to use external sources for it. This process involves putting in Print(); statements throughout the code and seeing where the code breaks or freezes.
http://www.ninjatrader.com/support/f...ead.php?t=3418
You can also follow the link below to use Visual Studio as a debugging tool with NinjaTrader.
http://www.ninjatrader.com/support/h..._debugging.htm
Let me know if I can be of further assistanceCal H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by helpwanted, Today, 03:06 AM
|
1 response
8 views
0 likes
|
Last Post Today, 03:35 AM | ||
Started by Brevo, Today, 01:45 AM
|
0 responses
7 views
0 likes
|
Last Post
by Brevo
Today, 01:45 AM
|
||
Started by aussugardefender, Today, 01:07 AM
|
0 responses
5 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
242 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
385 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
Comment