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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        81 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        42 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        66 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        55 views
        0 likes
        Last Post CarlTrading  
        Working...
        X