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!
See more
See less

Partner 728x90

Collapse

Debugging Real-time Error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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

    Comment


      #3
      Originally posted by elitetradernyc View Post
      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?
      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.

      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


        #4
        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


          #5
          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 assistance
          Cal H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by benmarkal, Yesterday, 12:52 PM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by helpwanted, Today, 03:06 AM
          1 response
          20 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          11 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          244 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Working...
          X