Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketDepth

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

    OnMarketDepth

    Hi,

    Using beta20 (but I don't think anything has changed with beta22), instrument 6S 12-10, on 21 Oct 2010 at 06:03:55 UK time.

    My DOM shows bid/ask 1.0350/1.0351, with no volume on bid at 1.0349.

    OnMarketDepth has given me volume of 1 at 1.0349. The relevant updates were:


    (position, price, vol)

    UpdateBid | | 0 | 1.0349 | 1

    InsertBid | | 0 | 1.035 | 1

    #2
    Which data provider is being used? Please provide a screenshot of what exactly you are seeing. Are you saying DOM has volume everywhere but 1.0349? So a gap?

    Also will need the code for what you are using to generate that output. Thanks.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      This is replay data from your server. Yes, there's a gap at 1.0349. I can't get a screen shot right now, but I'm sure you can picture it. I also can't try the sample depth code right now, but my code prints out all events and I've copied the ones that relate to bid/1.0349

      thanks
      Dave

      Comment


        #4
        Have you ensured you had data on your chart available prior to beginning the replay? This is important to adhere by for proper printouts from OnMarketData/Depth.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          I'm not using charts, and it's all real time so prior data is unimportant.

          If a bid update is posted, it goes to the dom and OnMarketDepth at pretty much the same time right? Prior data is irrelevant after the actual bid update. It doesn't add or subtract.

          Comment


            #6
            To begin playing the stream of OnMarketDepth correctly absolutely requires prior data to exist prior to the replay start. The issue at hand is not about when events are received/displayed, but rather the relationship of the events with the overall book.

            I am not sure how you would run an indicator that would print OnMarketDepth without a chart. Please clarify.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              I really don't see how past data is relevent, but yes, I'm pretty sure my strategy and the dom get some past data so that they're positioned correctly. In fact, this happened after they'd both been running for quite a while, and agreeing, so it's clearly nothing to do with past data. It may well be to do with gaps.

              I am not sure how you would run an indicator that would print OnMarketDepth without a chart. Please clarify.
              Who said anything about an indicator? Come on Josh ;-) It's a strategy.

              Comment


                #8
                In that case we will need your exact script in use to test on our end. Thank you.
                Also, do you only have L1 replay data for this date or also L2?
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Sorry Josh I can't send it in.

                  I have L2 data too.

                  Leave it with me and I'll see what I can do.

                  Dave

                  Comment


                    #10
                    A question -

                    Does GetCurrentBid always return the new updated bid when called in OnMarketDepth. I would expect OnMarketDepth to be called after Ninja updated internals such as the current bid?

                    thanks
                    Dave

                    Comment


                      #11
                      Originally posted by dave1992 View Post
                      A question -

                      Does GetCurrentBid always return the new updated bid when called in OnMarketDepth. I would expect OnMarketDepth to be called after Ninja updated internals such as the current bid?

                      thanks
                      Dave
                      Dave,


                      The following lines of code will display the latest updated values for each in OnMarketData.


                      if (e.MarketDataType == MarketDataType.Ask)AskPrice = e.Price;

                      if (e.MarketDataType == MarketDataType.Bid)BidPrice = e.Price;

                      if (e.MarketDataType == MarketDataType.Last)LastPrice = e.Price;

                      if (e.MarketDataType == MarketDataType.Ask)AskVolume = e.Volume;

                      if (e.MarketDataType == MarketDataType.Bid)BidVolume = e.Volume;

                      if (e.MarketDataType == MarketDataType.Last)LastVolume = e.Volume;


                      In OnMarketDepth there are multiple levels of "Bid" and"Ask". Not just the most recent best bid like in OnMarketData.


                      Hope this helps,


                      RJay
                      RJay
                      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                      Comment


                        #12
                        Thanks RJay,, but what I need is the current bid/ask, hence my question. I could work it out, but that would be slower than using the call if the call works.

                        Comment


                          #13
                          GetCurrentBid()/Ask() gets you the current bid/ask at the moment of calling. This is not necessarily the same as the absolute latest bid/ask as those can be ahead already by the time your code gets around to processing GetCurrentBid/Ask.
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #14
                            Thanks Josh. I realise that it's not the real bid ask at the exchange, I'm talking about the bid ask that Ninja should know.

                            i.e. is this sequence of events always valid

                            1. NT receives new L2 which has a new ask
                            2. NT updates its own idea of the current ask with the new ask
                            3. NT calls OnMarketDepth
                            4. OnMarketDepth calls GetCurrentAsk and gets this new ask.

                            thanks
                            Dave

                            Comment


                              #15
                              Originally posted by dave1992 View Post
                              Thanks Josh. I realise that it's not the real bid ask at the exchange, I'm talking about the bid ask that Ninja should know.

                              i.e. is this sequence of events always valid

                              1. NT receives new L2 which has a new ask
                              2. NT updates its own idea of the current ask with the new ask
                              3. NT calls OnMarketDepth
                              4. OnMarketDepth calls GetCurrentAsk and gets this new ask.

                              thanks
                              Dave
                              To clarify how this all works, I have tried to summarize it with an example:

                              1. NT receives a new ask event (on thread A) from the underlying API it uses to connect to the data source
                              2. NT updates the internal MarketData object with this new price
                              3. NT calls OnMarketData() and/or OnMarketDepth() on thread B
                              4. As new events come in, MarketData object is updated, and OnMarketData() and OnMarketDepth() methods are called for each price change
                              5. Calling GetCurrentAsk() and GetCurrentBid() returns the value contained in the Market Data object which is the most recent (last) ask price received via the API
                              6. Since this is on a separate thread, its possible and likely that OnMarketData() and OnMarketDepth() has yet to be called for this most recent value
                              RayNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              581 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              338 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              552 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X