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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    64 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X