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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        68 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        151 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        162 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        100 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        288 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X