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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      475 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      315 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      253 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      340 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      305 views
      0 likes
      Last Post CarlTrading  
      Working...
      X