NexusFi: Find Your Edge


Home Menu

 





Limit and Market order mechanics


Discussion in Traders Hideout

Updated
      Top Posters
    1. looks_one josh with 3 posts (20 thanks)
    2. looks_two bobwest with 1 posts (1 thanks)
    3. looks_3 Stops5 with 1 posts (2 thanks)
    4. looks_4 blackgrey45 with 1 posts (0 thanks)
    1. trending_up 214 views
    2. thumb_up 23 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread

Limit and Market order mechanics

  #1 (permalink)
 
josh's Avatar
 josh 
Georgia, US
Legendary Market Wizard
 
Experience: None
Platform: SC
Broker: Denali+Rithmic
Trading: ES, NQ, YM
Posts: 6,242 since Jan 2011
Thanks Given: 6,780
Thanks Received: 18,248

I was reading a thread where there was confusion around market and limit orders placed above or below the market which can be filled immediately. This seems to be a strangely persistent confusion. This post attempts to clarify some things.

A buy market order says "buy this market at any price." In many years of trading I have only rarely actually used a true market order. It's like writing a blank check. When exiting positions it's different, because when using a stop order, I use a stop market order, because when exiting (particularly a loss), I truly want out, and I truly don't care about the price.

A buy limit order says "buy this market at X price or better (for a buy, better = lower)." The "or better" part is what apparently confuses people.



Let's look at the example in the attached image. ES is trading 04.00 x 04.25 and there are 12 contracts to sell at 04.25, 18 contracts to sell at 04.50, and 18 to sell at 04.75. You enter a buy limit order to buy 40 contracts at 04.50. What will happen is that first you will match against the 12 contracts at 04.25, then the 18 contracts at 04.50, for a total of 30 contracts bought. Since you have 10 contracts unfilled, you will now be bid for those remaining 10 contracts at 04.50. You will only get filled on some or all of your 10 contracts if someone else sells at 04.50 or lower.

Now imagine a scenario where you want to buy market for 40 contracts. In the scenario shown, you would be filled on 12 contracts at 04.25, 18 at 04.50, and the remaining 10 at 04.75. However, because there is a delay between when you physically click the button and when your order is filled, in that span of time, someone else could sweep the book higher (they place a large order which takes the market higher). While your eyes see 04.25 as the best offer as you click the mouse, by the time your order is filled it could quite literally be points higher. Automated sweeping of the book in a single trade happens all the time. This is the "blank check" that I seek to avoid writing when entering positions.
Edit: the above scenario was corrected from a previously erroneous example I gave, thanks to @Stops5 for pointing out my error. Two posts below, there is an example of a sell sweep given similar to the buy sweep example given in the above paragraph.

In this same scenario if your order was a buy limit at 04.50 for only 1 contract instead of 40, you'd be filled long at 04.25, the market still would be 04.00 x 04.25, and there would now be 11 remaining contracts on the book to sell at 04.25.

What you have done is placed a marketable limit order. It's "marketable" because it will immediately fill as much of your requested quantity possible, matching against the current liquidity in the order book, and it is a "limit" because it only matches your given price or better. Your price is the limit.

This is how it works. There's no ambiguity. Every exchange does it exactly this way.

Now, there are nuances which are exchange specific. For example, CME's protection limits for market orders and stop market orders. These are the types of details which will vary between exchanges, and while it is good to know, it does not factor into any of the above basic mechanics about how orders are handled. No need to muddy the waters here as it's out of scope, but it's good to understand at least.

Most times when I enter a trade, I use a marketable limit order as described above. I position my cursor in the buy column a few ticks above the inside market and when I'm ready to buy, I click. I'm placing a marketable limit order. This almost guarantees that I am filled immediately, but also guarantees that if some event occurs in the few milliseconds between when my brain tells my finger to click, that if the market moves rapidly, I will never buy at a higher price than where I click (usually 2-3 ticks above). When I want to work an order instead (that is, I want to place an order in the book instead of getting an immediate fill), I will place the order below the inside market wherever I want to buy.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
 Stops5 
Tampere/Finland
 
Experience: Beginner
Platform: Sierra Chart
Broker: Edge Clear
Trading: Futures
Posts: 91 since Mar 2011
Thanks Given: 302
Thanks Received: 93


josh View Post
In this same scenario if your order was to buy market for 40 contracts then you would have gotten filled on the 12 at 04.25, the 18 at 04.50, and then the other 10 would have been filled at progressively higher prices. Why is this dangerous? Well, imagine that all the offers sitting at 04.75 and higher were placed by an algorithm and not a human. Imagine it's a thin market and that when the automated program sees your 30 contracts filled at 04.25 and 04.50, it pulls all offers up to 06.00 (yes, this can happen, though in a thicker market like ES it won't be extreme). Suddenly now you've bought 10 contracts much higher than you intended since the next offers are at 06.00. This is the "blank check" that I seek to avoid writing when entering positions.

Can you back up your claim that an automated program can pull orders in that scenario? I thought you get filled for those 40 contracts instantly (one timestamp) and automated programs are only able to react after the whole fill?

Reply With Quote
Thanked by:
  #3 (permalink)
 
josh's Avatar
 josh 
Georgia, US
Legendary Market Wizard
 
Experience: None
Platform: SC
Broker: Denali+Rithmic
Trading: ES, NQ, YM
Posts: 6,242 since Jan 2011
Thanks Given: 6,780
Thanks Received: 18,248



Stops5 View Post
Can you back up your claim that an automated program can pull orders in that scenario? I thought you get filled for those 40 contracts instantly (one timestamp) and automated programs are only able to react after the whole fill?

I can't back up my claim because I am wrong. I reviewed https://www.cmegroup.com/confluence/display/EPICSANDBOX/CME+Globex+Matching+Algorithms for reference, and you're correct: a single order for 40 lots in this case would be matched all at once against all available liquidity. So, an algo can't pull liquidity until your order has been fully matched (whether it's a complete or partial fill). I have updated the original post to reflect this change.

However, something just as detrimental can happen if using a pure market order. Because there is a delay between when you physically click the button and when your order is filled, in that span of time, someone else could sweep the book and while your eyes see 04.25 as the best offer as you click the mouse, by the time your order is filled it could quite literally be points higher. Automated sweeping of the book in a single trade happens all the time. For example, in this screenshot from today, at 15:39:36, someone swept the book 2.25 points with a single 1500 lot sell. Had you clicked your mouse a fraction of a second before this order to sell at the market, you would have found yourself short 9 ticks lower than anticipated!



Thank you again for pointing out the error. I love being wrong because it means I learned something
Still, the advice remains the same, but not for the erroneous reason I stated.

Started this thread Reply With Quote
  #4 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,172 since Jan 2013
Thanks Given: 57,495
Thanks Received: 26,292


josh View Post
I can't back up my claim because I am wrong. I reviewed https://www.cmegroup.com/confluence/display/EPICSANDBOX/CME+Globex+Matching+Algorithms for reference, and you're correct: a single order for 40 lots in this case would be matched all at once against all available liquidity. So, an algo can't pull liquidity until your order has been fully matched (whether it's a complete or partial fill). I have updated the original post to reflect this change.

However, something just as detrimental can happen if using a pure market order. Because there is a delay between when you physically click the button and when your order is filled, in that span of time, someone else could sweep the book and while your eyes see 04.25 as the best offer as you click the mouse, by the time your order is filled it could quite literally be points higher. Automated sweeping of the book in a single trade happens all the time. For example, in this screenshot from today, at 15:39:36, someone swept the book 2.25 points with a single 1500 lot sell. Had you clicked your mouse a fraction of a second before this order to sell at the market, you would have found yourself short 9 ticks lower than anticipated!



Thank you again for pointing out the error. I love being wrong because it means I learned something
Still, the advice remains the same, but not for the erroneous reason I stated.

I really, really like and appreciate this post. Thanks for the honesty and the attitude about it.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
Thanked by:
  #5 (permalink)
 
blackgrey45's Avatar
 blackgrey45 
Marco Island, FL
Legendary Market Wizard
 
Experience: Beginner
Platform: Sierra Chart
Broker: AMP Global
Trading: MCL MES
Frequency: Several times daily
Duration: Minutes
Posts: 783 since Jul 2022
Thanks Given: 877
Thanks Received: 909


Stops5 View Post
Can you back up your claim that an automated program can pull orders in that scenario? I thought you get filled for those 40 contracts instantly (one timestamp) and automated programs are only able to react after the whole fill?

@josh, I know you corrected yourself, but just to be clear on the matter for myself: @Stops5 is referring to a situation where the trader clicks the "market buy" button, then, according to cme order matching rules, the algorithm can not pull the orders on the offer side after the market orders are entered because they have been matched already?

Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
josh's Avatar
 josh 
Georgia, US
Legendary Market Wizard
 
Experience: None
Platform: SC
Broker: Denali+Rithmic
Trading: ES, NQ, YM
Posts: 6,242 since Jan 2011
Thanks Given: 6,780
Thanks Received: 18,248


blackgrey45 View Post
@josh, I know you corrected yourself, but just to be clear on the matter for myself: @Stops5 is referring to a situation where the trader clicks the "market buy" button, then, according to cme order matching rules, the algorithm can not pull the orders on the offer side after the market orders are entered because they have been matched already?

Basically, yes.

Imagine you had an order to sell a few ticks above the current market. You are free to cancel that order at any time you want. However, you do *not* have the ability to observe an order which *would* fill you and then cancel your order. Said another way, when the big market buy which comes in to sweep the book enters the matching phase, its entire quantity will match in a single, atomic "transaction" (from a perspective external to the system, to us, the users). It will not match against all the orders at one price, report that, then another price, report that, etc., giving anyone the opportunity to cancel orders. If you're in the book to sell and you're "in the path" of the buy order (meaning, the sell limit orders below yours and including yours is not sufficient to completely fill the order) then your liquidity will be used to fill that order.

To be clear, this all applies to the FIFO matching algorithm. Though FIFO is always used when all orders at a price level can be matched (the requested liquidity is greater than or equal to the current top of book liquidity) regardless of the algorithm used, the matching would be different if other algorithms like pro rata or LMM are being used.

Started this thread Reply With Quote




Last Updated on April 13, 2024


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts