Why did my limit order get executed at market price?
A limit order allows you to buy or sell a stock at the price you have set or a better price.
In other words, if you place a buy limit order, your order will buy the stock at your limit price or a lesser price but not at a higher price. Similarly, a sell limit order will sell the stock at your limit price or at a higher price but not at a lower price.
Explanation with an example
In the below screenshot, the LTP of SBIN is 185.40; the best bid and offer are at 185.35 and 185.40 respectively.
If you place a limit buy order at 190, since there is an offer to sell at 185.40, SBIN will be bought at 185.40. Since buying at Rs.185.40 means you are getting the stock for Rs. 4.60 less than what you are willing to pay.
If you place a limit sell order at 180, since there is a bid to buy at 185.35 your order will get sold at 185.35. Since selling at Rs.185.35 means you are getting Rs. 5.35 more than what you are asking to sell the stock.
This is how the exchange matching engine works.
What if you wanted to buy only at 190 or sell only at 180 in the above example?
You can use Trigger orders
Trigger orders are those where the actual orders aren’t placed on the exchange matching engine. Instead of the order, a trigger price is placed which can fire the actual order if the last traded price hits or crosses the trigger price.
At Zerodha we have two types of trigger orders:
- Good till triggered (GTT) orders - validity up to 1 year.
- Stoploss orders which can be used as trigger orders - valid only for the day.
So instead of using a limit order, you could place a GTT (or SL) order to buy the stock at a limit of 190 or at market price with a trigger of 190. So what this does is when the stock price reaches 190, the trigger is met, and your order to buy at 190 is fired. Similarly, place a selling limit or market order with a trigger price of 180.
Make sure to read up on GTT and SL before using them.