Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData vs OnBarUpdate

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

    OnMarketData vs OnBarUpdate

    Hi,

    My broker tells me OnBarUpdate is guaranteed to eventually get every tick (trade) regardless of the speed of the market but that the ticks could end up being queued and will be sent out in order. This makes sense and is consistent with my experience regardless of the data feed.

    They also tell me order book changes may be coalesced by using snapshots (the broker is not Interactive Brokers) if that is necessary to keep the data feed from being delayed by a very fast moving market. This also makes sense and consistent with retail data feeds.

    What they cannot tell me is whether this would apply to the volume component of MarketDataType.Last in OnMarketData or just the book updates.

    I have two indicators, one uses the volume from MarketDataType.Last in OnMarketData and the other uses the volume from the ticks in OnBarUpdate. They go out of sync in a fast move usually if there is what appears to be a large order that has been shredded such that a 100 lot gets broken into 100 one lots all with essentially the same timestamp.

    What I am trying to determine is which method will have the most accurate volume data?

    Best Regards,
    Scott

    #2
    Hello ScottB,
    OnBarUpdate and OnMarketData is called on respecive thread and they might not be synced. Please refer to our help guide which states:

    With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa.


    Both the events will return you the correct values however since they are not synced they might not match at the same time.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Joydeep,

      Thanks for getting back to me. Yes, I know the multi threading issues involved but I am not expecting them to stay in sync trade by trade. If you took a 10 minute period and they are significantly different then there is a reason.

      If book data is coalesced, would that apply to level 1 (OnMarketData), level 2 (OnMarketDepth), book changes only, MarketDataType.Last, etc. Hopefully you get the idea.

      The values are different and the only code difference is where the volume is taken from. Given I know OnBarUpdate to be queued rather than coalesced that seems to point to some combination of the market data/depth not getting every .Last in a fast moving market. The broker has verified that the data is coalesced at times, it is the matter of knowing exactly what data I am trying to get to.

      This is a variation on a conversation I had a few weeks back with technical support where they verified all this but I didn't know to ask at the time exactly what data was affected. If it would be better if you could send me a PM to take this offline

      Comment


        #4
        Hello ScottB,
        Thanks for the clarification.

        To assist you further may i know who your connectivity provider/broker is.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by selu72, Today, 02:01 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by WHICKED, Today, 02:02 PM
        2 responses
        12 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by f.saeidi, Today, 12:14 PM
        8 responses
        21 views
        0 likes
        Last Post f.saeidi  
        Started by Mikey_, 03-23-2024, 05:59 PM
        3 responses
        51 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by Russ Moreland, Today, 12:54 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X