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

DOM data

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

    DOM data

    Hi, how can we inquire DOM data (ask, bid, ask vol, bid vol, #contract sold at bid or ask , tick up or tick down etc) for indicator developement?

    #2
    You will want to take a look at OnMarketData().
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks.

      What's the different between last and ask/bid? Is last either a price hit at the bid or ask?

      protected override void OnMarketData(MarketDataEventArgs e)
      {
      // Print some data to the Output window
      if (e.MarketDataType == MarketDataType.Last)
      Print("Last = " + e.Price + " " + e.Volume);
      else if (e.MarketDataType == MarketDataType.Ask)
      Print("Ask = " + e.Price + " " + e.Volume);
      else if (e.MarketDataType == MarketDataType.Bid)
      Print("Bid = " + e.Price + " " + e.Volume);
      }


      So, if I want to know how many contracts sold at ask, then I will do
      if MarketDataType.Ask
      then Volume is the contracts sold at ask ?

      If I want to detect the price has moved one level of depth, then I will do:
      if MarketDataType.Ask is greater than previous MarketDataType.Ask, then
      price has move one level up

      How do I know how many asks at current level?

      Above is just pseudo code. If you can confirm my analysis, it'll be appreciated

      Comment


        #4
        Perhaps this reference sample will be more helpful: http://www.ninjatrader-support2.com/...ead.php?t=3478

        Last is the last traded price. Bid/ask are just the bid and ask price. Also, consider using GetCurrentBid() and GetCurrentAsk(). For volume you can also use GetCurrentBidVolume()/GetCurrentAskVolume().
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Could you help to explain this section?


          // Checks to see if the action taken by the Ask data was an insertion into the ladder
          if (e.Operation == Operation.Insert)
          rows.Insert(e.Position, new LadderRow(e.Price, e.Volume, e.MarketMaker));

          /* Checks to see if the action taken by the Ask data was a removal of itself from the ladder
          Note: Due to the multi threaded architecture of the NT core, race conditions could occur
          -> check if e.Position is within valid range */
          else if (e.Operation == Operation.Remove && e.Position < rows.Count)
          rows.RemoveAt(e.Position);

          Comment


            #6
            Prices move in and out of the DOM. That is what you are seeing with the insertion and removals.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Sorry. Did you mean removal happens when somebody pulls out the order from the immediate bid or ask level? And, insertion is when somebody placed orders at bid or ask?

              Comment


                #8
                Right ssg10, order placed and pulled from the DOM bid / ask levels.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  I tried on FESX just now, and it shows a lot of updates. What does UPDATE mean? There are many updates not only at current price neigbors, but also far away in the depth.

                  Bid Update 2353 846 2355
                  Depth: Ask Update 2355 735 2355
                  Depth: Bid Update 2354 178 2355
                  Depth: Bid Update 2352 708 2355
                  Depth: Bid Update 2351 871 2355
                  Depth: Ask Update 2355 737 2355
                  Depth: Bid Update 2354 181 2355
                  Depth: Ask Update 2358 780 2355
                  Depth: Bid Update 2352 735 2355
                  Depth: Bid Update 2351 851 2355
                  Depth: Ask Update 2355 716 2355
                  Depth: Ask Update 2355 737 2355
                  Depth: Bid Update 2354 171 2355
                  Depth: Ask Update 2358 779 2355
                  Depth: Bid Update 2350 679 2355
                  Depth: Ask Update 2355 716 2355
                  Depth: Bid Update 2354 181 2355
                  Depth: Ask Update 2362 523 2355
                  Depth: Bid Update 2350 669 2355
                  Depth: Bid Update 2346 746 2355
                  Depth: Ask Update 2355 717 2355
                  Depth: Ask Update 2355 738 2355
                  Depth: Ask Update 2355 717 2355
                  Depth: Ask Update 2355 738 2355
                  Depth: Ask Update 2358 829 2355
                  Depth: Ask Update 2355 737 2355
                  Depth: Bid Update 2354 182 2355
                  Depth: Bid Update 2353 867 2355
                  Depth: Bid Update 2348 593 2355
                  Depth: Bid Update 2354 181 2354
                  Depth: Bid Update 2353 865 2354
                  Depth: Bid Update 2352 737 2354
                  Depth: Bid Update 2354 171 2354
                  Depth: Bid Update 2354 172 2354
                  Depth: Ask Update 2358 838 2354
                  Depth: Bid Update 2351 841 2354
                  Depth: Ask Update 2355 708 2354
                  Depth: Bid Update 2353 869 2354
                  Depth: Ask Update 2355 738 2354
                  Depth: Ask Update 2359 749 2354
                  Depth: Bid Update 2353 895 2354
                  Depth: Ask Update 2355 717 2354
                  Depth: Ask Update 2360 823 2354
                  Depth: Ask Update 2364 685 2354
                  Depth: Ask Update 2355 705 2354
                  Depth: Bid Update 2354 173 2354
                  Depth: A

                  Comment


                    #10
                    This just means there's a change in the market depth occuring, people placing / pulling / parking orders at the various bid / ask levels, then the reported depth is udpated with the new contract quantity 'sitting' at those levels.
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      Thanks. So, insertion and removal events are basically redundant, then?

                      Comment


                        #12
                        Why would they be redundant? One removes a price, one adds a price.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          I meant we have:

                          - update
                          -insert
                          - remove

                          update is basically $x (t) - $x (t-1). So, if we get "update" event at time t at price $x = 100 and at time (t-1), it was 90, then we get insertion of 10. Right?

                          It is the same as "insert" event = 10 at $x

                          Am I thinking the right way?

                          Basically, right now, I am trying to make an indicator to calculate net bids lifted and bids inserted at current bid level (minus) contracts sold at that level. The same for asks.

                          Comment


                            #14
                            Not following you. They are absolutely different events. An update is an update of a certain price. An insert is adding of a new one. A removal is removing of a price.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Ok, that means my understanding is incorrect.

                              How do you define "adding a price" ? some examples are appreciated

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              11 responses
                              3,228 views
                              0 likes
                              Last Post xiinteractive  
                              Started by andrewtrades, Today, 04:57 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_Manfred  
                              Started by chbruno, Today, 04:10 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              440 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              12 views
                              0 likes
                              Last Post FAQtrader  
                              Working...
                              X