Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

AddDataSeries synchronization

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

    AddDataSeries synchronization

    I can't find this information....but I remember there was an issue that when BarsInProgress = 0 has not produced a bar yet and I try to access BarsInProgress = 1

    For example, my primary series is a 20 Range bar and my secondary data series is a 15 minute bar...if the data starts loading at midnight it is possible that there is not yet a BarsInProgress = 0 and then BarsinProgress = 2 (15 minute) is producing a bar.

    here is the error

    Indicator 'AAQuarter': Error on calling 'OnBarUpdate' method on bar -1: 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.

    #2
    ok, this works in OnBarUpdate to make sure both series have their first bar...thanks

    if (CurrentBars[0] <= 0 || CurrentBars[1] <= 0)
    return;

    Comment


      #3
      Hello llanqui,

      I just wanted to comment that you have reached the correct answer, the if condition you provided is the correct way to make sure both series have processed a bar.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      222 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      140 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      154 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      237 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      195 views
      0 likes
      Last Post CarlTrading  
      Working...
      X