Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate misses prints

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

    OnBarUpdate misses prints

    I have experienced a problem with OnBarUpdate in NinjaTrader 7 that is difficult to reproduce, but I am positive it exists. Specifically, it's missing prints.

    This problem is most easily noticeable on relatively thin stocks (100-200K shares per day) that have decent price movement (at least 50 cents on the day). Of course, there's no way I can tell you which stocks will fit this criteria tomorrow, so you will probably need to test this on multiple stocks.

    The easiest way to test this is to have two instances of NinjaTrader open at the same time. On one, create a simple strategy that prints the time and price whenever OnBarUpdate is fired. On the other, create a simple strategy that prints the time and price whenever OnMarketData is fired with a price update. Theoretically, both routines should print exactly the same number of lines with exactly the same values, but I'll guarantee that the OnMarketUpdate program has more prints. The problem does not occur often and may only happen on a few stocks per day, but it does occur during critical moments like when the stock is tanking.

    I have experienced this situation many times, but I don't have the resources to run two occurrences of NinjaTrader nor the time to stare at one stock for an entire day. I have modified my program to print a line on every occurrence of OnBarUpdate and have seen many instances where there was as much as a 90-second delay between OnBarUpdate firings, but the price updated three or four times in Interactive Brokers. Since switching my program to use OnMarketData, I have never experienced this problem of missing prints.

    #2
    Hello egan857,
    To assist you further can you tell me what is the code you are using for your test.

    I look forward to assisting you further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      I just described a very simple program that you guys can easily create to test this situation. You don't need a complex program that buys and sells stocks, just one that logs the time and price of the prints.

      Comment


        #4
        Hello egan857,
        OnMarketData is the raw stream, and it will trigger on every available market data type. It may be last, bid ask etc etc.


        OnBarUpdate on the other hand updates only when the data type (which you have defined) is triggered.

        The 2 are not the same and if you simply put a print statement you will rightly witness a difference.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          I understand that. That's why I described that the OnMarketData program will only log the time and price on a print (MarketTypeData = MarketDataType.Last). If you filter out the quote updates, then theoretically OnBarUpdate and OnMarketData should be identical, and I'm saying that they are not.

          Comment


            #6
            Hello,

            This has been tested and we could not find any issue with Calculate On Bar Close = false OnBarUpdate() is called on each tick along with OnMarketData() in our test scenario.

            To further assist here we would need to narrow this down further. The best way I can think of to do this is inside of market replay which would give us something reproducible.

            Do you have any print logs and code you ran to output these prints that you can provide so that we can take a look to analyze from the output you are seeing?

            Do you ever run in replay and seen this in replay mode if so can you reproduce it at all for us to further assist?

            Thanks.
            BrettNinjaTrader Product Management

            Comment


              #7
              Please test it again, this time using live data. I'm telling you, OnBarUpdate is missing prints, and I can see it in real life by printing the prices from NinjaTrader to the price updates I see on the Interactive Brokers screen. It's very possible that IB has additional feeds with extra prints that Kinetick doesn't have, but I have never experienced this problem since migrating to OnMarketData.

              Comment


                #8
                Hello,

                I went ahead and ran the test again on video for you on live IB data.

                World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


                Test: Pass.


                -Brett
                BrettNinjaTrader Product Management

                Comment


                  #9
                  Seriously?!?!? You ran it for two minutes against futures data and consider this to be anything similar to what I was describing? Try it for a full day against a couple hundred stocks with 100-200K volume before you declare success.

                  Comment


                    #10
                    I actually ran this test for an hour.

                    I just did the video so I can prove to you I ran the test.

                    Here is where we are at, This is a major part of our program that literally every single strategy developer uses.

                    I can run my tests for days and may never run into the issue and we still wouldnt have anything isolated.

                    Normally we do not run tests without a well defined problem scenario. In this case I wanted to run the tests just to make sure nothing obvious was wrong.

                    In this case we would need a defined problem scenario to debug this, currently we do not have this nor do we have your original prints from when you originally reported the issue to analyze. The problem literally could be anything at this point such as something simple as a session template caused no OnBarUpdate() to be fired since it was out of session.

                    The next steps here would be for me to get a hold of your prints and test scenario with time and date so I can analyze where you had this happen on your side and go from there.

                    We can then make a plan on how best to reproduce this and resolve once we get that data in.

                    Thanks.
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      Never mind. You don't get it.

                      The problem isn't with emini futures, which are pretty thickly traded. The problem is with medium-to-thin equities that are experiencing large (for them) movements in a short period. 99+% of the time, OnMarketData prints and OnBarUpdate updates are identical. The issue is that they do differ, and they differ just when it matters most. But, like we discussed in private, I have lost hundreds of dollars on this issue and I am absolutely positive it exists. Prove it for yourself or not, I don't care.

                      Comment


                        #12
                        Understood, if you can provide the additional information needed to isolate this I will look into ASAP. Unfortunately there is no defined scenario or no evidence provided of the problem at this point for me to analyze, therefor I have nothing to go from at this point in time.

                        I will continue to run the test on my side on some low volume stocks as long as I can, but without additional information I am unlikely to find the scenario you ran into.

                        -Brett
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Originally posted by egan857 View Post
                          Never mind. You don't get it.

                          The problem isn't with emini futures, which are pretty thickly traded. The problem is with medium-to-thin equities that are experiencing large (for them) movements in a short period. 99+% of the time, OnMarketData prints and OnBarUpdate updates are identical. The issue is that they do differ, and they differ just when it matters most. But, like we discussed in private, I have lost hundreds of dollars on this issue and I am absolutely positive it exists. Prove it for yourself or not, I don't care.
                          If this is something you're seeing regularly (aka you expect it will happen again sometime in the next week), why not just write your OnMarketData output and OnBarUpdate output to a file, and then when it happens you can go back and look at the file and see exactly where it occurred. Or have some kind of thing that will write the time to a file when the OnMarketData output doesn't match the OnBarUpdate output, something like that.

                          Comment


                            #14
                            Hi Radical,

                            This thread started because Brett noticed that I'm using a workaround to the OnBarUpdate problem by using OnMarketData. The cost of using OnMarketData is increased CPU usage, but my CPU's sitting around 0-1% utilization. My immediate problem is a memory leak, and that's costing me real money until I can solve it. Creating gigabytes of log files to prove something I already know to be true, about a problem for which I have a workaround, is a waste of my time right now and really should be done by Ninja's QA department anyway. I'm just reporting the problem. They can find it just as easily as I could.

                            Comment


                              #15
                              Originally posted by egan857 View Post
                              They can find it just as easily as I could.
                              Not if it's a problem that's unique to your situation/setup.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              577 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
                              553 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