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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    52 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    189 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    354 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    273 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X