Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate' method on bar 1632

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

    Error on calling 'OnBarUpdate' method on bar 1632

    Hi,

    When I enable strategies, this error appears in the logs, and the strategy doesn't start.

    Also, sometimes when they are running, they deactivate with the same error.

    Here the error on logs : "Error on calling 'OnBarUpdate' method on bar 1632: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart."

    Could you help me with this?

    #2
    Hello Thomas79,

    That is a general error message indicating that a BarsAgo was used at an incorrect time. The bar being 1632 suggests it happened later in processing, which could point to a multi-series problem if you're using more than one series. To address this type of error, you'd need to add prints to the script to see which line is causing the error. Based on that observation, it would be more apparent what needs to be corrected.





    Comment


      #3
      Hi
      thx for the answer, however, i don't understand what is "prints" to the script ? where do i have to add it ?

      I don't use multi-series...

      Comment


        #4
        Hello Thomas79,

        You can read about adding prints here:

        Comment


          #5
          ok thx, this is due to an indicator i use.

          Is it possible to add an alert by sound, pop up or email if a strategie is disabled ?

          Comment


            #6
            Hello Thomas79,

            Not for an error like the one you had posted about, if you are terminating the strategy for a specific reason in the code you could certainly do that. The error you posted about is a logical error that needs corrected to prevent the strategy from stopping.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            78 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            131 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            79 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            242 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            331 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X