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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    44 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    58 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    35 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    95 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    59 views
    0 likes
    Last Post PaulMohn  
    Working...
    X