Announcement

Collapse
No announcement yet.

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 Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                574 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X