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 argusthome, 03-08-2026, 10:06 AM
            0 responses
            114 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            61 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            40 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            43 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            82 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X