Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate frequency

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

    OnBarUpdate frequency

    Hi,

    I have a strange problem. I run this strategy on 1-tick series:

    protected override void OnBarUpdate() {
    Print(Time[0]+" Trade "+VOL()[0]+" at "+Close[0]+" Now = "+DateTime.Now);
    }

    against FGBL 12-10 replay file for 21st Oct at 07:10 (GMT+1) and I get this output:

    21/10/2010 07:10:01 Trade 2 at 129.91 Now = 01/11/2010 15:14:49
    21/10/2010 07:10:02 Trade 3 at 129.91 Now = 01/11/2010 15:14:54
    21/10/2010 07:10:07 Trade 10 at 129.91 Now = 01/11/2010 15:14:56
    21/10/2010 07:10:09 Trade 61 at 129.92 Now = 01/11/2010 15:15:05

    In the T&S window I see all the trades as they happen. However OBU doesn't seem to be called for the trade at 07:10:09 until about 7 seconds after it appears in the T&S window. What's going on? This happens every time I run this.

    thanks
    Dave

    #2
    Dave, I was unfortunately not able to reproduce your observations, I see no lag in the OBU calls here running FBGL 12-10 on this day in replay - what load is on your PC / task manager as you run those tests? Any maxing out happening perhaps?

    Thanks

    Comment


      #3
      Thanks for the reply Bertrand.

      No, the machine/CPU etc is fine. It takes the same delay time every time.

      Comment


        #4
        I would then try a fresh downloaded replay file for this day, just in case there was any corruption present.

        Comment


          #5
          I think it's extremely unlikely to be that. It's the mismatch between the T&S window and OBU that is worrying. I will try a fresh file when I get a chance though.

          Could you please post the output you got in trying to reproduce.

          thanks
          Dave

          Comment


            #6
            Dave, please find attached what I see here on my end with your setup. Please let me know what you think is not to your expectations.

            Thanks
            Attached Files

            Comment


              #7
              Hi Bertrand,

              We have to compare like with like here. I think you may be looking at the wrong time, since your prices and trade amounts are different to mine. Perhaps you need to use GMT - the 21st was GMT+1, but it's now GMT.

              Also, you need to execute it all at 1x speed. I assume that may not be the case, since you have trade 07:09:33 fired at real time 09:32:10 and trade 07:09:59 fired at the same time.

              thanks
              Dave

              Comment


                #8
                Dave, this is what I get for your testing time -

                10/21/2010 7:10:01 AM Trade 2 at 129.91 Now = 11/2/2010 4:18:21 PM
                10/21/2010 7:10:02 AM Trade 3 at 129.91 Now = 11/2/2010 4:18:26 PM
                10/21/2010 7:10:07 AM Trade 10 at 129.91 Now = 11/2/2010 4:18:29 PM
                10/21/2010 7:10:09 AM Trade 61 at 129.92 Now = 11/2/2010 4:18:38 PM

                NT is event based, not time based - this would mean the the OnBarUpdate() is called on the opening tick of the new bar and you're comparing this to the timestamp of the historical bars.

                Comment


                  #9
                  I see what you're saying, but surely that doesn't apply to 1- tick bars? As soon as one tick is received you know the bar is complete and can fire OBU. Surely Ninja doesn't execute all OBUs 5 mins after the tick if all ticks were seperated by 5 mins?

                  Comment


                    #10
                    That concept would apply to any bars type - if you don't receive a tick for 10 secs because the market is quiet then there would be no OnBarUpdate() call.

                    Comment


                      #11
                      Don't worry, I've sorted it out. Just set calc on bar close to false. I think I just subconsciously assumed that wouldn't matter for a 1-tick bar.

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        I would then try a fresh downloaded replay file for this day, just in case there was any corruption present.
                        This may be a bit out of place because I am running NT6.5, but my guess is the same is true for both 6.5 and 7.

                        How does one get a fresh replay file for a day? I've had days when I have lost connection, and I have no idea how to get a fresh set of data saved away. I would like to be able to have a full, tick by tick record of the day for a limited number of instruments and I would like to be able to do it after the day is done. I have a real-time indicator that I do not want to interrupt with a "Reload historical data" if the connection loss is momentary.

                        In the db\data folders I see files with extensions .ntm and .nt2. What is the difference, and do I need to keep both types? I have an XP machine and a Windows 7 machine, both running NT 6.5. The XP machine seems to only have .ntm files, while the Windows 7 has both kinds. I do see some .nt2 in my XP folders, but that might be because I copied them over from the Windows 7 machine.

                        Comment


                          #13
                          Originally posted by dave1992 View Post
                          Don't worry, I've sorted it out. Just set calc on bar close to false. I think I just subconsciously assumed that wouldn't matter for a 1-tick bar.
                          Glad to hear you've got it working as you expect Dave.

                          Comment


                            #14
                            Originally posted by HNWtrader View Post
                            This may be a bit out of place because I am running NT6.5, but my guess is the same is true for both 6.5 and 7.

                            How does one get a fresh replay file for a day? I've had days when I have lost connection, and I have no idea how to get a fresh set of data saved away. I would like to be able to have a full, tick by tick record of the day for a limited number of instruments and I would like to be able to do it after the day is done. I have a real-time indicator that I do not want to interrupt with a "Reload historical data" if the connection loss is momentary.

                            In the db\data folders I see files with extensions .ntm and .nt2. What is the difference, and do I need to keep both types? I have an XP machine and a Windows 7 machine, both running NT 6.5. The XP machine seems to only have .ntm files, while the Windows 7 has both kinds. I do see some .nt2 in my XP folders, but that might be because I copied them over from the Windows 7 machine.
                            This would only apply to NT7, as with this release we introduced recording of the replay files on our server and making them available for download - hence you would not have to record them on your own.

                            To record Level 1 data (ntm file) a chart or Market Analyzer window running the instrument is sufficient.

                            To record Level 2 data (nt2 file) you would need to have a SuperDOM window running for each instrument of interest.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            579 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            334 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            101 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            554 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            551 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X