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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X