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

Time[0]

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

    Time[0]

    Hello,

    I wanted to get some clarification on what Time[0] actually returns. From the support website: (http://www.ninjatrader.com/support/h....html?time.htm), I understand that it would return the timestamp of a historical bar.

    1. Does Time[0] also give us the timestamp of live bars?

    2. If the answer to #1 is no, how do I get the timestamp of the most recent bar?

    3. Does Time[0] return the start-time or the end-time of the current bar?

    Thank you.

    Isaac

    #2
    Hello Isaac,

    Thank you for your post.

    1. Time[0] will return the current bar in real-time when you have set the script to CalculateOnBarClose = False: http://www.ninjatrader.com/support/h...onbarclose.htm

    2. See above.

    3. Time[0] is the end time of the bar. On a time based interval such as Minute chart it will return the minute the bar will close. On tick based intervals, Time[0] with CalculateOnBarClose = False would return the most recent update to the bar.

    Comment


      #3
      Thank you.

      One quick follow-up: does NT have a built-in method to return the current time? Or should I just use DateTime.Now as in standard C# if I want retrieve the current time?

      Comment


        #4
        Hello ivb73077,

        Thank you for your response.

        There is no built in method in NinjaScript for the PC time, this means you would in fact use DateTime.Now.

        Comment


          #5
          Perfect. Thanks.

          Comment


            #6
            Patrick,

            I guess I should have inquired: what does Time[0] return when CalculateOnBarClose = true?

            Comment


              #7
              Hello Isaac,

              Time[0] will return the timestamp of the last closed bar when CalculateOnBarClose = True. This is the same over historical data.

              Comment


                #8
                Got it. Thanks.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by guillembm, Yesterday, 11:25 AM
                2 responses
                9 views
                0 likes
                Last Post guillembm  
                Started by junkone, 04-21-2024, 07:17 AM
                9 responses
                68 views
                0 likes
                Last Post jeronymite  
                Started by trilliantrader, 04-18-2024, 08:16 AM
                4 responses
                18 views
                0 likes
                Last Post trilliantrader  
                Started by mgco4you, Yesterday, 09:46 PM
                1 response
                11 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by wzgy0920, Yesterday, 09:53 PM
                0 responses
                10 views
                0 likes
                Last Post wzgy0920  
                Working...
                X