Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[0] and time stamp difference, how come?

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

    Time[0] and time stamp difference, how come?

    Hi,

    I'm running a 3 minute strategy and have an output print before the close at the 15:54 EST bar, but when I compare it to the time stamp I see a difference.
    Date 6/23/2011 Time:15:54
    Time Stamp: 16:04:01
    This is the Print output from the strategy. What can cause this difference?

    Tx!

    #2
    freewind,

    What is the code used to generate that output? What interval is the strategy applied to? Time[0] is the time stamp of a bar, and this can be in advance of the current time. Example: Viewing a 15 minute bar at 15:03 could be time stamped at 15:15.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Code:
      Print("Date " + Time[0].Date.ToString("d") + " Time:" + Time[0].ToString("H:mm")); 
      Print("Time Stamp: " + DateTime.Now.ToString("H:mm:ss"));
      This is the code and the series is 3 minutes bar. What I posted before is the output in the output window.
      The time difference is 10 minutes that doesn't make any sense to me.
      Please advise.

      Thanks!

      Comment


        #4
        I don't see any particular issue. You're printing the time stamp of a bar -- 15:54, and the time stamp of your computer clock which is 16:04. These are two different components. What result are you expecting with those statements?
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          This is taken from a live strategy!!!!!
          I would expect them to be the same. The OnBarUpdate() should be called on 15:54 and not 16:04.
          This is critical for me because I want to make the calculation before the close at specific time!

          Comment


            #6
            The ouptput does not yet point to an issue here. You're requesting a bar time stamp and your computer clock time which are two different things.

            What is the strategies calculate on bar close setting?
            What did the chart look like at the time -- the time stamp of the most up to date bar.
            Are you sure the time stamp printed belongs with the latest updated bar?

            Essentially you're reporting a data updating issue, and should use other ways of checking this besides your script output. The time and sales window is time stamped according to the data provider, and your chart bars are time stamped according to your PC clock. You can then look at time and sales compared to what you see on the chart to see if there is any discrepancy.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Hi Ryan,

              I'm working with Ninja more then 2 years and never had such a situation.

              I'm running 4 strategies with same code but with different instruments simultaneously.
              2 of them execute the OnBarUpdate() with sync. with the pc clock at 15:54 and the other 2 have a 10 minute delay. I really stuck in understanding what can cause this.
              Did someone report similar problem in the past? Is there a limitation on executing strategies on the same time?

              Comment


                #8
                I looked at this from a high level but basically your bar time stamp and PC clock are different. This can be for two reasons.

                - Your PC clock is wrong
                - The data coming into NinjaTrader is truly behind

                If your PC clock is wrong, then you need to find out why the data was lagging. Here are some common reasons I can think of:

                - Users are not entitled to receive real time data from their market data vendor so they are defaulted to delayed ten or fifteen minute data
                - Some internet issue between you and your data vendor that caused the delay
                - Temporary issue with your market data vendor

                Generally in cases like this assuming you are entitled for real time data, you first have to notice the delay. You can then disconnnect/reconnect to see if that fixes things since doing this would clear out any data buffer building up at the data vendor. If data is still delayed, you could check with the data vendor to see if there are any known issues.
                RayNinjaTrader Customer Service

                Comment


                  #9
                  I should add that running multiple strategies should not have a negative impact. I would also look at a T&S window when you see a lagging situation and check if the T&S time stamps are also lagging. If yes, then this points to a data feed issue, if T&S is correct but the bar time stamp is lagging, then we definintely need to look into this further since that would not make sense.
                  RayNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Ray!
                    I'll check with my data provider maybe one of the instruments is not getting real time data!

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by algospoke, Yesterday, 06:40 PM
                    2 responses
                    19 views
                    0 likes
                    Last Post algospoke  
                    Started by ghoul, Today, 06:02 PM
                    3 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    45 views
                    0 likes
                    Last Post jeronymite  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    7 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by AttiM, 02-14-2024, 05:20 PM
                    10 responses
                    180 views
                    0 likes
                    Last Post jeronymite  
                    Working...
                    X