Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

32 seconds left in 30 second chart

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

    32 seconds left in 30 second chart

    this morning I am running a 60 sec chart with my strategy and 30, 15 and 5 sec charts with no strategy

    all charts are running an indicator that uses the following code to plot seconds remaining in each bar

    TimeSpan barTimeLeft = Bars.Get(Bars.Count - 1).Time.Subtract(Now);

    the indicator runs fine in the strategy 60 sec chart(where it is being added by the strategy)....in all others it shows more time than the bar interval....for instance at the start of each bar in the 30 sec chart it shows 32 secs...in the 15 it shows 17 secs....in the 5 sec it shows 7 secs

    how can this be? ydy is was working perfectly and this morning in Market Replay fine

    I am connected to Zenfire as is one of my users who is having the same problem

    is this a data feed server problem this morning?

    thanks

    #2
    ATI user,

    Please try resyncing your PC clock and restarting NT. When using the BarTimer indicator you will always need to ensure your PC clock is in sync.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thanks Josh

      fixed the problem even without NT restart

      my comp is set to automatically sync with Internet Time....any idea how it would get out of sync?

      Comment


        #4
        PC clocks are kept via your computer. Some motherboards have bad CMOS or CMOS batteries and when the computer is turned off the clock tracking cycles are not kept perfectly. When you turn it back on it can be out of whack a few seconds after a night. Other people may experience poor clock tracking even with Windows on and will just have to sync it every once in awhile.

        In a nutshell, PC clock is tracked by hardware and there is nothing we can do to assist in this matter.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          thanks

          here is freeware to sync automatically if anyone is interested...seems to work fine


          download the free atomic clock sync config utility to optimize how your Windows pc receives updates from time servers

          Comment


            #6
            Thanks ATI user, very convenient.

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              ATI user,

              Please try resyncing your PC clock and restarting NT. When using the BarTimer indicator you will always need to ensure your PC clock is in sync.
              Josh

              Not doing well this morning

              I have manually synced the clock several times and restarted NT several times thereafter and I still am getting more seconds in the chart than the interval of the chart

              any other solutions?

              thanks.

              Comment


                #8
                ATI user,

                All I can suggest is for you to ensure the PC clock is synced. BarTimer compares the timestamps of your bars with the time of your PC clock to determine the time left. When they are out of sync you will get erroneous readings.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  how can I check if synced...after i manually sync

                  the bars are all stamped the right time...for instance, the 5 second chart has all bars stamped on 5 or 0 seconds...so NT is plotting/stamping correctly

                  the problem is that, on an intermittent basis now, the time code says there are 7 seconds remaining in a 5 second bar...which would be from comparing the PC time to the bar stamp...how the PC clock can be off by 2 seconds after manually syncing to time.windows.com is beyond me...unless NT is using a different time server that is out of sync with time.windows.com.

                  Please see the attached list and tell me if NT uses one of there servers...if not ....which one so I can sync to it....3 of my users are using time.windows.com and all have the problem....one is synced to time-a.timefreq.bldrdoc.gov and has the problem

                  I am not using the NT indicator 'BarTimer'...rather I am using the code:

                  TimeSpan barTimeLeft = Bars.Get(Bars.Count - 1).Time.Subtract(Now);

                  where barTimeLeft is returning 7 on a 5 second bar chart
                  Attached Files

                  Comment


                    #10
                    ATI user,

                    Use DateTime.Now and print when a new bar starts. They should be in increments of 5 seconds.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      if ( FirstTickOfBar )
                      {
                      Print("*** DateTime.Now "+DateTime.Now );
                      }

                      yields the attached from a 5 second chart
                      Attached Files

                      Comment


                        #12
                        Remember this is not a scientific approach. FirstTickOfBar can be any time within those 5 seconds. In a liquid market you should be able to get a general overview picture of the sync though.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Originally posted by NinjaTrader_Josh View Post
                          Remember this is not a scientific approach. FirstTickOfBar can be any time within those 5 seconds. In a liquid market you should be able to get a general overview picture of the sync though.
                          right...thanks....FirstTickOfBar is not want I want to check sync...especially on the YM around noon

                          here is my problem:

                          OnBarUpdate executes on every tick. How can the following code, at any time, return secondsRemaining = 7 if the PC clock is in sync?

                          TimeSpan barTimeLeft = Bars.Get(Bars.Count - 1).Time.Subtract(Now);
                          secondsRemaining = barTimeLeft.Seconds;

                          Regardless of what time the tick comes into the bar, there can not be more than 5 seconds remaining in a 5 second chart...and certainly not 7 seconds if the PC clock is in sync...no way it can be out by 2 seconds ever

                          Comment


                            #14
                            As mentioned, BarTimer checks bar timestamp against your PC clock. It doesn't care what the time on the ticks are. Your PC clock is not in sync with the data you have and that is why you are seeing discrepancies. Whether this is an issue with your PC clock or an issue with the timestamps on your data, there is nothing NT can do. All I can suggest is for you to sync your PC clock. If the auto syncing isn't cutting it, do a manual offset to sync it yourself. You can also try deleting your data and reloading new ones.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by NinjaTrader_Josh View Post
                              You can also try deleting your data and reloading new ones.
                              how will deleting data work? I am on live feed. Does saved data affect the timestamp?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              633 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              364 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              567 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X