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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      82 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      43 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      68 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      56 views
      0 likes
      Last Post CarlTrading  
      Working...
      X