Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Working with several time frames.

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

    Working with several time frames.

    Good morning.

    I am coding a strategy that works OnEachTick and that uses time frames of 1 tick, 5 seconds and 60 minutes. This strategy is executed on a 1-minute chart.
    My question is the following: I need to take the maximum, minimum, opening and closing values ​​of the current 60-minute candle [0] (the one that is forming) but, until it finishes, the program takes into account the values ​​of the previous candle in each tick (which is the one that is really finished). How can I make it so that, while OnEachTick performs the relevant calculations, it waits until the 60-minute candle finishes so that it only takes into account the values ​​of its closing?

    Thank you very much in advance and have a nice day.​

    #2
    Hello BIOK.NT,

    Require BarsInProgress to be 3 and require IsFirstTickOfBar to be true. Then use a barsAgo index of [1] (for the completed previous bar) with Closes[3][1].

    if (CurrentBars[3] > 1 && BarsInProgress == 3 && IsFirstTickOfBar)
    {
    Print(string.Format("{0} | Closes[3][1]: {1}", Times[3][1], Closes[3][1]));
    }
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    128 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    117 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X