Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Difference in NT8

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

    Time Difference in NT8

    Hi,

    I created a simple strategy and it will just print the Time[0] value and System Time value in the output window.

    protected override void OnBarUpdate()
    {

    Print("Time ="+Time[0].ToString("dd/MM/yy HH:mm:ss.fff")+ " Now = "+DateTime.Now.ToString("dd/MM/yy HH:mm:ss.fff"));


    }

    On the output window i noticed that there is a small difference in MilliSeconds part. May i know why this difference ..? How can i match both the time are same..?

    I attached the Screenshot here.
    Attached Files

    #2
    I don't think they would ever match at that level.

    Comment


      #3
      Originally posted by rmk View Post
      Hi,

      I created a simple strategy and it will just print the Time[0] value and System Time value in the output window.

      protected override void OnBarUpdate()
      {

      Print("Time ="+Time[0].ToString("dd/MM/yy HH:mm:ss.fff")+ " Now = "+DateTime.Now.ToString("dd/MM/yy HH:mm:ss.fff"));


      }

      On the output window i noticed that there is a small difference in MilliSeconds part. May i know why this difference ..? How can i match both the time are same..?

      I attached the Screenshot here.

      If you do this, you should get 3 different times.


      Print("B4 Now = "+DateTime.Now.ToString("dd/MM/yy HH:mm:ss.fff")+"Time ="+Time[0].ToString("dd/MM/yy HH:mm:ss.fff")+ " Now = "+DateTime.Now.ToString("dd/MM/yy HH:mm:ss.fff") );

      And B4Now should be > Time but < Time, and of course < Now.


      Comment


        #4
        Hello rmk,

        Thank you for writing in. There is going to be a very small delay between the current time and the bar time because the data has to move from the data provider all through the internet to reach your computer. To improve the delay time you will want to be running NinjaTrader on a computer closer to the exchange you are trading on. To remove it completely you would basically need to be hardwired directly into the exchange.

        Please let me know if I may be of further assistance.
        Michael M.NinjaTrader Quality Assurance

        Comment


          #5
          Time Difference

          Hi Michael,
          Thank you for your response.I am more confused as another thread reply by PatrickG says "The timestamps of you chart are controlled by your local PC clock.".http://ninjatrader.com/support/forum...rt+update+time. If its controlled by PC clock why millisec difference ?

          Thanks
          rmk

          Comment


            #6
            Hello rmk,

            I apologize for the confusion, this is going to depend on your connection. For example, Continuum provides native timestamps where as Interactive Broker's has timestamps assigned locally. However, if you ignore the Time[0] variable all-together and just print out DateTime.Now twice in a row, you will see different times (as sledge suggested). This is because the commands are not processing parallel to each other so a very small amount of time occurs between when each is printed resulting in the milliseconds delay you are noticing.

            I hope this helps to clarify. Please let me know if I may be of further assistance.
            Michael M.NinjaTrader Quality Assurance

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by andrewtrades, Today, 04:57 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by chbruno, Today, 04:10 PM
            0 responses
            5 views
            0 likes
            Last Post chbruno
            by chbruno
             
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            436 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            7 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            19 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X