Master order execution mechanics
Core Concept
Order execution mechanics is the process by which your buy/sell instruction travels from your screen to the exchange and gets matched with a counterparty. Understanding this determines whether you get filled at your desired price, how much you pay in slippage, and why your order sometimes sits unfilled.
A badly executed trade can cost you 0.5-2% in slippage on a volatile stock. On a ₹1,00,000 trade, that's ₹500-₹2000 lost to execution alone—dwarfing your₹20 brokerage fee.
The Order Execution Journey
Step 1: Order Placement (Client → Broker)
You submit an order through your broker's platform (web/app). The order contains:
WHY these matter: Each parameter changes how and when your order gets filled. A market order prioritizes speed over price; a limit order prioritizes price over speed.
Step 2: Broker Validation & Risk Checks
Before sending to the exchange, the broker:
- Checks margins: Do you have sufficient funds/stocks?
- Why: To prevent naked short selling or unpaid purchases (settlement failures)
- Validates order params: Is the price within circuit limits? Quantity in lot sizes?
- Risk management: Flags unusually large orders or suspected manipulation
If validation passes, the broker assigns an order ID and sends it forward.
Step 3: Order Routing (Broker → Exchange)
Indian brokers route orders to:
- NSE (National Stock Exchange)
- BSE (Bombay Stock Exchange)
- Sometimes both, depending on your selection and liquidity
Two routing models:
WHY routing matters: NSE might have tighter spreads for RELIANCE, but BSE might have better depth for a mid-cap. Smart order routing (SOR) systems split your order across exchanges to minimize slippage.
Step 4: Order Book Matching (Exchange)
The exchange maintains an order book—a live list of all buy and sell orders, sorted by price and time.
How it works:
BUY side (bids) sorted descending: | Price | Quantity | Time | |-------|----------| | ₹150.50 | 100 | 10:00:01 | | ₹150.50 | 200 | 10:00:03 | | ₹150.00 | 500 | 10:00:00 |
SELL side (asks) sorted ascending:
| Price | Quantity | Time |
|---|---|---|
| ₹151.00 | 300 | 10:00:02 |
| ₹151.50 | 150 | 09:59:58 |
| ₹152.00 | 400 | 10:00:05 |
Matching rules:
- A market buy matches with the lowest ask (₹151.00)
- A limit buy at₹151 will NOT match yet (best ask is ₹151, needs someone willing to sell at ≤₹151)
- If you place a limit buy at ₹151.50, you'll match immediately with the₹151.00 ask (you get a better price than your limit)
Order book state:
- Best ask: ₹151.00 (300 available)
- Next ask: ₹151.50 (150 available)
- Next ask: ₹152.00 (400 available)
Execution:
- First 300 shares: Filled at ₹151.00 (₹45,300)
- Next 150 shares: Filled at ₹151.50 (₹22,725)
- Last 50 shares: Filled at ₹152.00 (₹7,600)
Total cost: ₹75,625 → Average price = ₹151.25
WHY this matters: Your "market" order walked up the order book. The weighted average price (WAP) is higher than the best ask. This is slippage.
In the example:
On a ₹75,625 trade, slippage = ₹125. On a ₹10,000 trade, this scales to ₹1,650.
Step 5: Trade Confirmation & Settlement
Once matched:
-
Trade confirmation: Both buyer and seller receive a fill notification with:
- Execution price(s)
- Quantity filled
- Trade time (to the millisecond)
- Unique trade ID
-
Clearing: The exchange's clearing corporation (NSCCL for NSE) becomes the counterparty to both sides, guaranteeing settlement.
-
Settlement cycle: T+1 in India (Trade date + 1 working day)
- You buy on Monday → Shares credited to your demat on Tuesday
- You sell on Monday → Funds credited on Tuesday
WHY T+1: Gives time for funds and securities to move through the banking system and demat network (NSDL/CDSL).
Order Types Deep Dive
1. Market Order
Advantages:
- Guaranteed execution (if liquidity exists)
- Instant fills
Disadvantages:
- No price protection: You might get a terrible price in a fast-moving market
- High slippage on large orders or illiquid stocks
You paid5% more than expected due to a momentary liquidity vacuum.
When to use: High liquidity stocks (Nifty 50), small orders, when execution certainty matters more than a few paise.
2. Limit Order
Advantages:
- Price protection
- No slippage beyond your limit
Disadvantages:
- May never execute if market doesn't reach your price
- Partial fills (some quantity executed, rest cancelled)
Setup: Place a limit buy at ₹490 for 100 shares.
Scenario A: Stock touches ₹489.50 → Your order fills at ₹490 (you get a better price than your limit).
Scenario B: Stock drops to ₹491 and rebounds → Your order sits unfilled all day. You miss the trade.
When to use: When you have a target entry/exit price and are willing to miss the trade if the market doesn't cooperate.
3. Stop-Loss Order (SL / SL-M)
Structure:
- Trigger price: ₹95 (when to activate)
- Limit price: ₹94 (worst acceptable execution for SL-Limit)
How it works:
You buy a stock at ₹100. To limit losses, you place an SL-M sell at trigger₹95.
- Stock drops to ₹97, ₹96... order sits dormant
- Stock touches ₹95 → Order converts to market sell
- Executes at best available bid (might be ₹94.80 in a falling market)
WHY the trigger ≠ execution price: Between trigger and execution, the market keeps moving. In a crash, there might be a gap down.
SL-Market (SL-M):
- Stock crashes, triggers at ₹95
- Executes at ₹94.50 (best available)
- Result: You exit, taking a 5.5% loss
SL-Limit (trigger₹95, limit ₹94):
- Stock crashes, triggers at ₹95
- Order sits in book as "sell at ₹94 or better"
- If market gaps down to ₹92, your order doesn't execute (you wanted≥₹94)
- Stock falls to ₹88before you can react
- Result: 12% loss because you prioritized price over execution
When to use each:
- SL-M: When you must exit (risk management trumps price)
- SL-Limit: When you want to avoid panic selling at ridiculously bad prices (accepts risk of non-execution)
4. After Market Order (AMO)
Timing: Accepted from 3:45 PM to 8:57 AM (next day).
How AMOs execute:
- Orders enter the pre-open session (9:00-9:08 AM)
- Exchange calculates an equilibrium price that maximizes traded volume
- All AMOs execute at this single opening price
Action: Place an AMO to sell your holdings at market price.
Next day:
- Pre-open equilibrium: ₹480 (stock closed at ₹500)
- Your AMO executes at ₹480
- Regular session opens, stock drops to ₹470
- You saved ₹10/share by using AMO instead of waiting for regular hours
Risks: If you misjudged and markets gap up, your sell executes at a higher price than closing (opportunity cost of missing further gains).
Order Validity Types
Day Order
Remains active until3:30 PM, then auto-cancelled if unfilled.
Immediate or Cancel (IOC)
Must execute immediately (fully or partially). Any unfilled quantity is cancelled instantly.
Use case: Testing liquidity without leaving an order in the book.
Good Till Cancelled (GTC)
Not available on NSE/BSE for equities. Common in US markets (order stays active for 30-90 days).
Factors Affecting Execution Quality
1. Liquidity
Formula for spread:
Stock B (Low liquidity): Best bid ₹50.00, best ask ₹52.00
On a ₹1,00,000 trade, Stock B's spread alone costs you ₹3,920 in slippage.
2. Order Size vs. Depth

Derivation from first principles:
Let = your order size, = depth at price level .
If (your order exceds best price depth), you "walk the book":
What this means: Each "slice" of your order eats into the next price level. Large orders = guaranteed slippage.
You buy 100 shares:
- 50 @ ₹100.00 = ₹5,000
- 50 @ ₹100.10 = ₹5,005
- Avg price: ₹100.05
You buy 250 shares:
- 50 @ ₹100.00 = ₹5,000
- 100 @ ₹100.10 = ₹10,010
- 100 @ ₹100.25 = ₹10,025
- Avg price: ₹100.14
Larger order → worse price, even though you submitted a single instruction.
3. Volatility & Timing
Volatility increases slippage because:
- Order book thins (traders pull orders in uncertain conditions)
- Spreads widen
- Prices jump between your order submission and execution (even milliseconds matter)
Worst times to trade (highest slippage):
- First 15 minutes (9:15-9:30 AM): Opening volatility, amateur traders, order imbalances
- Last 15 minutes (3:15-3:30 PM): Institutional squaring off, fund managers closing positions
- News events: Earnings, policy announcements, global shocks
Best times: 10:00 AM - 2:30 PM (mid-session, stable liquidity).
Common Execution Mistakes
The steel-man: In a momentum breakout, waiting for your limit price might mean missing the move entirely. FOMO is a powerful force.
Why it's wrong: On a stock with 5% spreads, your market order guarantees a 2-3% loss before the trade even starts. You're betting the stock moves >5% just to break even on execution costs.
The fix:
- Use limit orders at near the best ask (for buys) / best bid (for sells)
- If it doesn't fill in 30 seconds, re-evaluate whether you really want this illiquid stock
- Consider: If there's no one to trade with, who will you sell to later?
The steel-man: Risk management books say "never lose more than 1-2% per trade." Tight stops seem disciplined.
Why it's wrong: Stocks have normal intraday volatility. A 2% stop on a stock that routinely swings ±3% intraday means you'll get stopped out by noise, not by the trade being wrong.
The fix:
- Measure the stock's Average True Range (ATR)
where = high, = low, = close.
-
Place stops at 1.5× to 2× ATR from entry
- If ATR = ₹5, and you enter at ₹100, use a stop at ₹90-₹92.50
-
Adjust position size so this wider stop still keeps your rupee loss within tolerance:
Stock: BHEL at ₹100, ATR = ₹4.
Stop distance: 2× ATR = ₹8 → Stop at ₹92.
Position size:
Capital required: 125 × ₹100 = ₹12,500.
Now if the trade fails, you lose exactly ₹1,000 (1%), but you gave the trade room to breathe.
Why it's wrong: Backtests assume you execute at the close price or open price. Reality:
- Market orders have 0.1-0.5% slippage
- Intraday scalping strategies show 50%+ returns in backtest but lose money live due to slippage
The fix: Add realistic execution costs to your backtest:
# Example: Adjusting backtest for slippage
entry_price = data['close'] * 1.001 # 0.1% slippage on entry
exit_price = data['close'] * 0.999 # 0.1% slippage on exitIf your strategy still works with0.2-0.5% round-trip costs, it might survive real trading.
Platform-Specific Execution Features
Bracket Orders (BO)
A 3-in-1 order:
- Entry (limit or market)
- Target (limit sell/buy)
- Stop-loss (SL-M)
Once entry executes, both target and stop-loss are auto-placed. If one executes, the other auto-cancels.
Use case: Intraday trading where you want to "set and forget" your risk/reward.
Constraint: BO not allowed for delivery trades (only MIS).
Cover Orders (CO)
Entry + compulsory stop-loss in a single instruction. You cannot have a position without a stop-loss.
Advantage: Lower margin requirements (since risk is capped by the stop).
Risk: If markets gap through your stop, you still face losses beyond the stop level.
Iceberg Orders
Used by institutions. Places a large order but shows only a small "visible" quantity in the order book.
Example: You want to buy 10,000 shares but show only 500 at time. As the 500 get filled, the next 500 appear.
WHY: Prevents tipping off other traders that a large buyer is in the market (which would drive prices up).
Monitoring Execution Quality
Metrics to Track
- Realized Slippage:
-
Fill Rate: Percentage of limit orders that execute
- <50% → You're chasing prices that never come
-
90% → You might be overpaying (too aggressive limits)
-
Average Execution Time: For market orders, should be <1 second in liquid stocks
-
Partial Fill Frequency: High rate suggests insufficient liquidity for your order size
Recall Explain This to a 12-Year-Old
Imagine you're at a busy vegetable market. You want to buy tomatoes.
Market order: You shout "I'll buy tomatoes at whatever price!" The seller hears this and charges you extra because you're desperate. You get tomatoes instantly, but pay more.
Limit order: You say "I'll only pay₹40 per kg." Now you have to wait. If a seller agrees, great. If not, you go home without tomatoes.
Stop-loss: You already bought tomatoes at ₹40. You tell your friend, "If the price drops to ₹30, sell my tomatoes immediately." This way, if tomatoes start roting (losing value), you get out before losing too much.
The order book is like a big board showing:
- People willing to BUY tomatoes and at what price (highest price at top)
- People willing to SELL tomatoes and at what price (lowest price at top)
When a buyer's price matches a seller's price, a trade happens! The vegetable market uncle (exchange) makes sure both sides follow the rules.
If you try to buy 100 kg of tomatoes but there are only 20 kg at₹40, you'll have to pay ₹42 for the next batch, and₹45 for the batch after that. That's slippage—the more you buy, the more you pay.
Connections
- Order book dynamics and depth analysis — How to read the order book to predict short-term moves
- Bid-ask spread and market liquidity — Why spreads matter and how to measure liquidity
- Brokerage models and fee structures — How brokers make money from your orders (PFOF, ST, etc.)
- Risk management and position sizing — Using execution mechanics to calculate correct position sizes
- Market microstructure and price discovery — How trades at the micro level determine prices
- Algorithmic trading and smart order routing — How institutions minimize slippage with algos
- Pre-open and post-close sessions — Special trading sessions with different rules
- Circuit breakers and trading halts — When exchanges freeze order execution and why
#flashcards/stock-market
What is the difference between a market order and a limit order? :: Market order executes immediately at the best available price (no price control, guaranteed execution). Limit order executes only at your specified price or better (price control, may not fill).
What is slippage and when does it occur?
How does price-time priority work in order matching?
What is the settlement cycle in India?
What's the difference between SL-Market and SL-Limit orders?
Why do large orders cause worse execution prices?
What is an After Market Order (AMO)?
How do you calculate the bid-ask spread percentage?
What is a Bracket Order?
Why should stop-loss be placed relative to ATR?
What happens to a limit order if the market moves past your limit price?
What is an Iceberg Order?
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Chalo simple tarike se samajhte hain. Jab tum apne phone pe "Buy" button dabate ho, toh aisa nahi hai ki turant stock tumhare paas aa gaya. Actually mein tumhara order ek badi si auction line (queue) mein jaake khada ho jaata hai, jahan computer speed pe matching hoti hai. Yeh poora process — tumhare screen se lekar exchange tak aur wahan kisi seller ke saath match hone tak — usko hi bolte hain order execution mechanics. Iske beech mein tumhara order broker ke risk checks se guzarta hai (paise hain ki nahi, price circuit limit ke andar hai ki nahi), phir NSE ya BSE pe route hota hai, aur finally order book mein price-time priority ke hisaab se match hota hai. Matlab jiska price best hai woh pehle, aur agar price same hai toh jo pehle aaya (earlier timestamp) woh pehle match hoga.
Ab yeh matter kyun karta hai? Kyunki agar tum galat order type use karte ho, toh tumhe slippage ka nuksaan hota hai — yaani jis price pe tum kharidna chahte the aur jis price pe actually mila, uske beech ka fark. Ek volatile stock pe yeh 0.5-2% tak ho sakta hai. Socho ₹1,00,000 ka trade hai, toh sirf execution mein hi ₹500 se ₹2000 tak udd sakte hain — jabki brokerage sirf ₹20 hai! Isliye market order (jo speed chahta hai par price guarantee nahi deta) aur limit order (jo price fix karta hai par fill hone ka wait karwa sakta hai) ka fark samajhna bahut zaroori hai.
Toh yaad rakho, trading mein sirf "kaunsa stock kharidna hai" important nahi hai, balki "kaise kharidna hai" bhi utna hi important hai. Order book kaise kaam karta hai, tumhara order line mein kahan khada hai, aur konsa order type kab use karna hai — yeh chhoti chhoti cheezein tumhare profit-loss pe direct asar daalti hain. Ek chhota sa trader agar yeh mechanics samajh le, toh woh apni execution cost bahut kam kar sakta hai aur long run mein yahi difference bada faayda banta hai.