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 timko, Today, 06:45 AM
      1 response
      7 views
      0 likes
      Last Post gaz0001
      by gaz0001
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      3 responses
      41 views
      0 likes
      Last Post gaz0001
      by gaz0001
       
      Started by Max238, Today, 01:28 AM
      2 responses
      26 views
      0 likes
      Last Post NinjaTrader_ChristopherJ  
      Started by Shansen, 08-30-2019, 10:18 PM
      25 responses
      949 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      43 views
      0 likes
      Last Post JonesJoker  
      Working...
      X