Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Instrument.MarketDepth events

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

    Instrument.MarketDepth events

    Hello, I have a strategy where I access the market depth. In OnMarketDepth I get the MarketDepth object of the instrument which already contains the entire order book so it saves me from making it from scratch. I save this as a snapshot of the order book on every OnMarketDepth update. The only problem is the MarketDepth object is usually a few updates ahead of OnMarketDepth so I end up saving the same MarketDepth object sometimes 20+ times while OnMarketDepth catches up.

    Are there events ONLY for when the MarketDepth object is updated? I had a look through the code multiple times but couldn't find anything like that. I can always build my own order book from OnMarketDepth events but this seems less efficient, as the MarketDepth object seems to get multiple updates at once in the space of a single OnMarketDepth event, then gets nothing for multiple OnMarketDepth events as OnMarketDepth catches up. So it seems monitoring MarketDepth is more efficient as there would be much less events overall.

    #2
    Hello unQuantifiable,

    The correct way to use OnMarketDepth would be to manage the book yourself by using the individual events, we have a sample of how to build the orderbook here: https://ninjatrader.com/support/help...vel_ii_dat.htm

    Comment


      #3
      Hmm ok, just wanted to see if there was an alternative. Thank you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      78 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X