Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on calling 'OnBarUpdate'

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

    Error on calling 'OnBarUpdate'

    Hi

    I keep getting these similar messages almost on a daily basis"-
    Indicator '': Error on calling 'OnBarUpdate' method on bar 206: 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.
    The thing is it only happens on a 2 min, 5 min or 10 min chart. It doesn't happen on a 1 min, 3 min or 4 min chart. And to rectify the situation, I right click on the chart, select Data Series, and either increase of decrease the "Days to load" and the error is no longer there till the next day. Which 2 min, 5 min or 10 min chart produces the error is random.

    I've narrowed it down to 1 indicator. When you right click on the chart and select "Indicators...", in the configured section, the timeframe for the indicator is missing. And by either adding or subtracting the "Days to load", the timeframe on the said indicator reappears and all is well again.

    With respect to "Days to load", my default on 2 min is 7, 5 mins is 11 and 10 min is 17.

    How do I get to the bottom of this issue?

    Regards

    Kay Wai

    #2
    Hello Kay Wai,

    If this is a 3rd party script, please contact the vendor or developer that distributes that software to report the full error message with their software.

    If this is a script you have created, check any indexes used are less than the size of the collection. This means any bars ago values are less than CurrentBar, any list, array, or other collection, indexes are less than the array.Length or list.Count().

    Below is a link to a forum post that discusses invalid index errors.
    Hello, I want to create an indicator that show data in a chart but calculate in other charttime different to the time of the chart where is showed. For example:
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    41 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    27 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    45 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    37 views
    0 likes
    Last Post CarlTrading  
    Working...
    X