Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unable to load bars required

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

    Unable to load bars required

    Hi I am having trouble running my strategy live as it gives me the following error code

    Error on calling 'OnBarUpdate' method for strategy 'simpleMAcrossover/e079022e094f4dacb681d61c50c21380': 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.


    I have used the following method but it is still working.

    if (CurrentBar < 100)
    return;

    Could it be due to the fact that this is a multitimeframe strategy where I use:
    Daily, hourly and min data?

    Hope you can advise.

    #2
    Hello sgtrader888,
    In case of a multi series NinjaScript code you should check the bars for all bar series.

    Code:
    if (CurrentBars[0] < 20 || CurrentBars[1] < 20)
    { return; }
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thanks

      Thanks. It worked.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      648 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      369 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      108 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      572 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X