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

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 rhyminkevin, Today, 04:58 PM
      0 responses
      8 views
      0 likes
      Last Post rhyminkevin  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      5 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      12 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      48 views
      0 likes
      Last Post futtrader  
      Started by Option Whisperer, Today, 09:55 AM
      1 response
      15 views
      0 likes
      Last Post bltdavid  
      Working...
      X