Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get opening time of bar?

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

    How to get opening time of bar?

    On time based bars, the Time[0] gives the endtime of current bar. But how to get the opentime of current bar?

    a) for time based bars, it could be: Time[0].AddMinutes(- barsPerioidInMunites)
    b) for Not-time based bars?

    #2
    Hello TazoTodua,
    Thanks for your post.

    The answer here is variable depending on what specifically you are trying to do.

    Is this in historical or real-time?

    Is this Calculate.OnEachTick or Calculate.OnBarClose?

    Is this a multi series strategy?

    Can you provide the specific scenario in which you want to apply this concept?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      I think there could be a property like TimeOfOpen[0] which would give the opening time for bar.

      Comment


        #4
        Hello TazoTodua,

        You can use Calculate.OnEachTick/OnPriceChange to have the script see current tick of the developing bar (this would include the opening tick of a new bar.)

        You could also check Bars.GetOpen(CurrentBar+1) when using Calculate.OnBarClose.

        Please let me know if you have any questions.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        636 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        366 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        571 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X