Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

OnMarketDepth()

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

    OnMarketDepth()

    Hi folks,

    I'm having real problems with the behaviour of OnMarketDepth() when using market replay. Sometimes the MarketDepth event will fire correctly when I started to replay a session and build the rows of the order book (example below)

    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Ask
    Market Data Operation : Insert
    Market Data Position : 0
    Market Data Price : 1.6108
    Market Data Volume : 5


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Ask
    Market Data Operation : Insert
    Market Data Position : 1
    Market Data Price : 1.6109
    Market Data Volume : 1


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Ask
    Market Data Operation : Insert
    Market Data Position : 2
    Market Data Price : 1.611
    Market Data Volume : 41


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Ask
    Market Data Operation : Insert
    Market Data Position : 3
    Market Data Price : 1.6111
    Market Data Volume : 18


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Ask
    Market Data Operation : Insert
    Market Data Position : 4
    Market Data Price : 1.6112
    Market Data Volume : 7


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Bid
    Market Data Operation : Insert
    Market Data Position : 0
    Market Data Price : 1.6106
    Market Data Volume : 2


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Bid
    Market Data Operation : Insert
    Market Data Position : 1
    Market Data Price : 1.6105
    Market Data Volume : 8


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Bid
    Market Data Operation : Insert
    Market Data Position : 2
    Market Data Price : 1.6104
    Market Data Volume : 13


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Bid
    Market Data Operation : Insert
    Market Data Position : 3
    Market Data Price : 1.6103
    Market Data Volume : 29


    OnMarketDepth()
    Market Data Time : 09:40:30.84
    Market Data Time (ticks) : 633826428300847500
    Market Data Type : Bid
    Market Data Operation : Insert
    Market Data Position : 4
    Market Data Price : 1.6102
    Market Data Volume : 7


    However, on many occasions these events are not correctly fired and the order book is not correctly built (example below). You can see from the timestamps that on this occasion the first instance of the MarketDepth event being raised is 24 seconds after the previous example.

    OnMarketDepth()
    Market Data Time : 09:40:54.834
    Market Data Time (ticks) : 633826428548347500
    Market Data Type : Bid
    Market Data Operation : Update
    Market Data Position : 3
    Market Data Price : 1.6095
    Market Data Volume : 5


    OnMarketDepth()
    Market Data Time : 09:40:54.834
    Market Data Time (ticks) : 633826428548347500
    Market Data Type : Bid
    Market Data Operation : Update
    Market Data Position : 4
    Market Data Price : 1.6094
    Market Data Volume : 21


    OnMarketDepth()
    Market Data Time : 09:40:54.834
    Market Data Time (ticks) : 633826428548347500
    Market Data Type : Bid
    Market Data Operation : Update
    Market Data Position : 4
    Market Data Price : 1.6094
    Market Data Volume : 29


    Can you please advise as to how I can force a market replay session to always build the order book correctly.

    I am running NT v6.5.1000.12 and have the correct versions of the .NET framework.

    Thanks.

    #2
    ScoobyStoo, I'm not exactly sure I follow - this is not the same event you compare, first is an 'Insert', the second an 'Update'. Are you starting the comparing replay sessions at exactly the same time? Meanwhile please upgrade to 6.5.1000.13, which was released last week. Thanks
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      ScoobyStoo, I'm not exactly sure I follow - this is not the same event you compare, first is an 'Insert', the second an 'Update'. Are you starting the comparing replay sessions at exactly the same time? Meanwhile please upgrade to 6.5.1000.13, which was released last week. Thanks
      I'm as confused as you Bertrand. The example event dumps should be exactly the same as I was connected to the same market replay session using identical indicator code. For one of the indicators the order book was built correctly, for the other indicator no MarketDepth events were raised for the first 24 seconds and then randomly the events started to be raised.

      Me thinks there might be problems with some aspects of L2 market replay.

      Additionally, whilst running the Visual Studio debugger to follow the initialisation of the chart and indicators I found myself bizarrely inside the OnMarketData() event handler of an indicator that wasn't even loaded into the chart!

      All very strange...

      Comment


        #4
        ScoobyStoo, I remember your older thread regarding this, the last time we could not reproduce this on our end unfortunately. Maybe the indicator initialized was loaded in another workspace you currently did not activate while investigating this? If you could send me the exact steps / files you used I would like to take another look at this issue - please contact me directly at support at ninjatrader dot com Attn Bertrand - Thanks
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Bertrand View Post
          ScoobyStoo, I remember your older thread regarding this, the last time we could not reproduce this on our end unfortunately. Maybe the indicator initialized was loaded in another workspace you currently did not activate while investigating this? If you could send me the exact steps / files you used I would like to take another look at this issue - please contact me directly at support at ninjatrader dot com Attn Bertrand - Thanks
          Ok, Bertrand. Thanks for your help. Will email you.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by PaulMohn, Yesterday, 02:06 AM
          6 responses
          18 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by NM_eFe, Yesterday, 06:14 AM
          3 responses
          16 views
          0 likes
          Last Post NM_eFe
          by NM_eFe
           
          Started by PaulMohn, Yesterday, 01:45 PM
          3 responses
          2 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by ChartTourist, 04-27-2024, 08:22 AM
          4 responses
          56 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by r68cervera, Today, 04:45 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X