Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Identify if there are more buyers than sellers or vice versa

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

    How to Identify if there are more buyers than sellers or vice versa

    I would like to know if the syntax / concept of the code I am enclosing is way off or if maybe I have something backwards. Here is what I am trying to do.

    1. Check the volume of asks compared to volume of bids. If one is considerably greater than the other it should be easy for me to get a limit order filled going the opposite way. For example if there are more buyers than sellers, a limit order to sell would get filled but I would be in a crowded line as a buyer.

    2. I would expect that if I check these volume conditions and only enter trades that I can easily get limit orders filled on with this logic ninja trader would behave in the following way.

    A: In market replay if enforce immediate fills are checked or unchecked I would have virtually the same results, because checking the volume condition would ensure this.
    B: The statistics from running this code over several days at 500x speed in market replay would produce more or less the same figures. In theory I would expect to see 50% winners and 50% losers because this is how I wrote the profit target vs. stop loss and I am using random entries.

    However when I test this I see around 60% winners when enforce immediate fills are unchecked and around 40% winners when enforce immediate fills are checked. So I think something in my code must be off. If anyone could take a peak and provide some insight of where either my code if off or my thought process is off I would greatly appreciate it. If it helps.... I am testing this on ES with a 300 tick chart in 500x speed in market replay.

    Thanks,

    Ian Guthrie
    Attached Files

    #2
    Hello Ian,

    As this post is an inquiry about logic in your script, this would be outside of what is supported by NinjaTrader Support.

    However, this thread will remain open for any community members that would like to assist.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea,

      I can understand that. Could you please just help me out with the following pieces of code then to make sure I understand the concept / syntax then?

      Does the following access the level 1 volumes for bids and asks properly below?

      long ASK = GetCurrentAskVolume();
      long BID = GetCurrentBidVolume();

      And then from these could I determine if one is considerably larger than the other using something like:

      // check to see if the current volume of the asks are significantly greater than the current volume of the bids by at least 50.

      if( ASK > (BID + 50))
      {
      // Do something
      }

      Finally if this logic is solid should I be able to get filled more easily because I could get onto the side where their is a greater demand and less supply?

      Please let me know if this simple logic is way off or not.

      I appreciate it.

      Thanks,

      Ian

      Comment


        #4
        Hi Ian,

        Using (GetCurrentAskVolume() > GetCurrentBidVolume() + 50) would let you know if the ask volume is more than 50 contracts higher than the bid volume.

        Using GetCurrentAsk / GetCurrentBid methods only work in real-time so this strategy would not be back-testable.

        This also would be a snapshot of the current filled items at either the bid or the ask. This would not be a snapshot of the orders that are still working at a particular level in Level II data.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,

          Thank you for the clarification. Could I access the pending orders by using any of the OnMarketData methods? I have seen some documentation around using this method with level 1 data, but would this give me access to any pending orders or would I need level 2 data and marketdepth methods? Also regarding testing, could I potentially test this with a live data feed and a sim account / market replay?

          Comment


            #6
            Ian,

            To see working orders, this is part of Level II data and is not part of Level I data.

            Level II data can be accessed through OnMarketDepth().
            http://ninjatrader.com/support/helpG...arketdepth.htm

            Also, below is a link to an example order book.
            http://www.ninjatrader.com/support/f...ead.php?t=3478
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bmartz, 03-12-2024, 06:12 AM
            4 responses
            32 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by Aviram Y, Today, 05:29 AM
            4 responses
            12 views
            0 likes
            Last Post Aviram Y  
            Started by algospoke, 04-17-2024, 06:40 PM
            3 responses
            28 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by cls71, Today, 04:45 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X