Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Stanfillirenfro, Today, 07:23 AM
        9 responses
        23 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by George21, Today, 10:07 AM
        0 responses
        6 views
        0 likes
        Last Post George21  
        Started by DayTradingDEMON, Today, 09:28 AM
        2 responses
        18 views
        0 likes
        Last Post DayTradingDEMON  
        Started by navyguy06, Today, 09:28 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        8 responses
        32 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X