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

Market Depth - Stocks Vs Futures

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

    Market Depth - Stocks Vs Futures

    Hi

    I have some code that uses OnMarketDepth. I have mostly been running it on futures contracts. I have switched to stocks and I can see some discrepancies.

    I am using OnMarketDepth(MarketDepthEventArgs e) and then using e.Volume to get the volume bid or offer at any level.

    This is working fine in futures but not do well in stocks. With stocks, it just takes the volume from the first market maker and not the volume for the level.

    Is there a way to get the depth for a specific bid/ask level from OnMarketDepth or do I need to loop through the volume for each market maker?

    Confused....

    Pete

    #2
    Hello,

    There is an ID for market marker ID.



    Please print out the market maker ID and let me know what your seeing along with volume.

    I look forward to assisting you further.

    Comment


      #3
      Hi Brett

      What I get from OnMarketDepth is as follows (I put a print on the ask only):

      Ask Level 0 Market Maker BOSX Volume 0
      Ask Level 24.52 Market Maker BOSX Volume 100
      Ask Level 24.52 Market Maker PHLX Volume 700
      Ask Level 24.52 Market Maker BOSX Volume 200
      Ask Level 24.52 Market Maker PHLX Volume 200
      Ask Level 24.52 Market Maker PHLX Volume 1300
      Ask Level 24.52 Market Maker PHLX Volume 800
      Ask Level 24.52 Market Maker BATY Volume 300
      Ask Level 24.52 Market Maker EDGA Volume 200
      Ask Level 24.52 Market Maker PHLX Volume 400
      Ask Level 24.52 Market Maker PHLX Volume 500
      Ask Level 24.52 Market Maker BATY Volume 400
      Ask Level 24.52 Market Maker EDGA Volume 300
      Ask Level 24.52 Market Maker EDGA Volume 200
      Ask Level 24.52 Market Maker PHLX Volume 300
      Ask Level 24.52 Market Maker PHLX Volume 1400
      Ask Level 24.52 Market Maker BATY Volume 300
      Ask Level 24.52 Market Maker EDGX Volume 200

      What I am trying to do is get the total depth of the ask at the level. A bit like the DOM would do.

      Is this possible?

      Thanks

      Pete
      Last edited by DionysusToast; 02-17-2011, 11:01 AM.

      Comment


        #4
        Hello,

        Ok thanks for doing that test. THis confirms you are getting the lvl 2 data.

        Ok to do what your looking for here. Here is what you will need to do. You will need to create your own level 2 order book. Then you will be able to cycle through all the book entries and that add the volume together.

        Please see this guide on how to do this, what you will need to add is a counter variable to count the volume in the order book by constantly looping through it in OnBarUpdate for example.



        Let me know if I can be of further assistance.

        Comment


          #5
          Thanks Brett

          I had a look at your code and it's fairly similar to mine. Does it work on stocks or only futures ?

          I ask this because there is no totalling of volume in there - it just stores an array of market maker, price & volume.

          I did see there's a e.MarketDepth.Ask.TotalVolume but not sure what it does.

          Thanks

          Pete

          Comment


            #6
            Hello,

            This is not mentioned in our help guide therefor this may or may not work for you would just need to have you try it. Please post back if you are able to make this work.

            Otherwise then use a counter variable to add up all the volume in the ask book, for example as your looping through it.

            This will work on stocks and futures.

            Let me know if I can be of further assistance.


            Last edited by NinjaTrader_Brett; 02-18-2011, 10:39 AM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Segwin, 05-07-2018, 02:15 PM
            10 responses
            1,768 views
            0 likes
            Last Post Leafcutter  
            Started by Rapine Heihei, 04-23-2024, 07:51 PM
            2 responses
            30 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by Shansen, 08-30-2019, 10:18 PM
            24 responses
            943 views
            0 likes
            Last Post spwizard  
            Started by Max238, Today, 01:28 AM
            0 responses
            10 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by rocketman7, Today, 01:00 AM
            0 responses
            7 views
            0 likes
            Last Post rocketman7  
            Working...
            X