Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to know when multi timeframes are all loaded?

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

    How to know when multi timeframes are all loaded?

    I'm adding an extra data serie in the onstatechanched event (State==atatse.Configured or DataLoaded).
    The data series are all for the same instrument, but with different timeframes.
    The main (chart) data serie is M5, and the extra dataserie is D1.
    How can I determine when both data series are completely loaded, so that I can use Closes[1][1] without errors?
    I also need to get the ATR(Inputs[1], 14).Value[1] but get errors about "accessing a barsAgo for a bar that is not loaded yet".

    Please advice.

    #2
    Hello wjadevries, thanks for writing in.

    To check that you have at least 1 bar in both series, you can add this check at the beginning of OnBarUpdate:

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

    //access Closes[1][1] here, CurrentBars Documentation

    The ATR problem could also likely be fixed by adding this CurrentBars check at the top of OnBarUpdate.

    Please let me know if I can assist any further.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X