Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Times[0] vs. System.DateTime.Now

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

    Times[0] vs. System.DateTime.Now

    Hi Ninjatrader,

    I've searched and hope this hasn't been answered before, if so I apologize and request a link to the answer.

    I am seeing time differences in the bar Times[0] value and the current system time and having ruled out NTP clock disparity and want to understand why. For a liquid and actively traded security (emini S&P) the Time[0] timestamp with CalculateOnbarUpdate=true and the local system time varies greatly.

    Is the difference due to the time between the bar close and next tick received ? I understand that the bar will not be closed until an "after" tick is received, but given a liquid active contract in the middle of a busy session (emini s&p), I would assume that tick time to be insignificant. What am I missing in my reasoning?

    Thanks for insight.

    Number1

    #2
    Hello Number1,

    Thank you for your post.

    The Time[0] or Times[0[ is the bar's timestamp at close. The DateTime.Now is the PC clock time. These can varry based on when the bar closed and if the timestamps are local to your PC or native to the data provider's server. Information on the timestamps for each provider can be found at the following link: http://www.ninjatrader.com/support/h...rical_data.htm

    Comment


      #3
      Originally posted by number1 View Post
      Hi Ninjatrader,

      I've searched and hope this hasn't been answered before, if so I apologize and request a link to the answer.

      I am seeing time differences in the bar Times[0] value and the current system time and having ruled out NTP clock disparity and want to understand why. For a liquid and actively traded security (emini S&P) the Time[0] timestamp with CalculateOnbarUpdate=true and the local system time varies greatly.

      Is the difference due to the time between the bar close and next tick received ? I understand that the bar will not be closed until an "after" tick is received, but given a liquid active contract in the middle of a busy session (emini s&p), I would assume that tick time to be insignificant. What am I missing in my reasoning?

      Thanks for insight.

      Number1
      If you want the bars' TimeStamp to match the computer time, you must either use bars which are not time delimited, or else use CalculateOnBarClose = false;

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      160 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      307 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      244 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      348 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      178 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X