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