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 kawalecld, Today, 12:21 PM
            0 responses
            5 views
            0 likes
            Last Post kawalecld  
            Started by exjayess, Today, 11:04 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by robertlaub, Today, 11:11 AM
            2 responses
            7 views
            0 likes
            Last Post robertlaub  
            Started by sdauteuil, Today, 10:28 AM
            0 responses
            6 views
            0 likes
            Last Post sdauteuil  
            Started by KirkHammett, Today, 08:11 AM
            0 responses
            7 views
            0 likes
            Last Post KirkHammett  
            Working...
            X