Sub topic 11
Stop-market and stop-limit orders
A stop order stays off the order book until the market reaches a price you chose. At that point it becomes an ordinary market or limit order and goes through the matching engine like any other. This chapter covers how triggers work, how the two stop variants differ, and how each one fails.
Prerequisites
This chapter assumes you know the following:
- How an order book is laid out: bids, asks, depth, and the spread.
- How a market order walks the book and how a limit order rests or crosses.
- Average fill price, slippage, and partial fills.
You also need to read short Python programs.
Two prices, two stages
A stop order has two stages and usually two prices.
- Trigger price (also called stop price). It is a condition watched by the exchange. Nothing is on the book while it is being watched.
- Execution instruction. Once triggered, the order becomes either a market order (stop-market) or a limit order with your limit price (stop-limit).
The trigger direction depends on the side:
| Order | Triggers when the reference price | Typical use |
|---|---|---|
| Sell stop | falls to or below the trigger | Cap a loss on a long position |
| Buy stop | rises to or above the trigger | Enter on a breakout, or cap a loss on a short |
A sell stop is placed below the current price. A buy stop is placed above it. If the trigger is already satisfied when you submit, most exchanges reject the order or fire it immediately, depending on their rules.
What counts as the reference price
"The price reached my trigger" is ambiguous. Exchanges let you choose, or fix, one of these sources:
- Last traded price. It is easy to understand, but one small trade on a thin book can trip it.
- Mark price. Derivatives venues compute it from an index of several exchanges. It is harder to manipulate with a single trade.
- Best bid or ask. Some venues offer this. It reacts to quotes, not trades.
Check which source your venue uses by default. The same stop can fire on one source and not on another, and the difference matters most in fast markets.
Stop-market orders
A stop-market order turns into a market order when triggered. Its main property is that it will almost certainly execute. Its main weakness is that the price is unknown.
After the trigger, the order behaves like any market order. It takes liquidity, pays the taker fee, and walks the book. Slippage here is usually worse than for a normal market order, because stops tend to cluster at round numbers and below recent lows. When price reaches those levels, many stops fire together and all of them sell into the same bids.
Use a stop-market when getting out matters more than the exit price.
Stop-limit orders
A stop-limit order has two prices: the trigger and a limit. When triggered, it becomes a limit order at your limit price. It never fills at a price worse than the limit. It may also not fill at all.
For a sell stop-limit, the limit is normally at or below the trigger. A limit slightly below the trigger leaves room for price to move between the trigger and the order reaching the book. Some venues require a particular ordering between the two prices, so read the venue's rules.
If the limit is not marketable when the order activates, the order rests on the book. A resting order can be filled later if price comes back, and it can sit there while price keeps falling. Meanwhile you still hold the position you wanted to leave.
Simulating both variants
The following program triggers a sell stop and compares the two outcomes against two different books. The first book is orderly. The second is the book after a gap, where the bids have dropped well below the trigger.
def stop_triggered(side, trigger, last_price):
"""A sell stop fires when price falls to the trigger, a buy stop when it rises to it."""
if side == "sell":
return last_price <= trigger
return last_price >= trigger
def sell_into_bids(bids, qty, limit=None):
"""Walk bids (best, i.e. highest, first). Return (fills, remaining).
limit=None behaves as a market order; otherwise never sell below limit.
"""
fills = []
remaining = qty
for price, size in bids:
if remaining == 0 or (limit is not None and price < limit):
break
take = min(remaining, size)
fills.append((price, take))
remaining -= take
return fills, remaining
def average_price(fills):
qty = sum(q for _, q in fills)
return sum(p * q for p, q in fills) / qty if qty else None
trigger = 99.0
stop_limit_price = 98.5
qty = 4.0
books = {
"orderly": [(99.0, 1.0), (98.5, 2.0), (97.0, 5.0)],
"gap": [(96.0, 3.0), (95.0, 10.0)],
}
for name, bids in books.items():
last = bids[0][0] # last trade is near the best bid
print(name, "triggered:", stop_triggered("sell", trigger, last))
fills, left = sell_into_bids(bids, qty)
print(" stop-market:", fills, "unfilled:", left, "avg:", average_price(fills))
fills, left = sell_into_bids(bids, qty, limit=stop_limit_price)
print(" stop-limit: ", fills, "unfilled:", left, "avg:", average_price(fills))The output is:
orderly triggered: True
stop-market: [(99.0, 1.0), (98.5, 2.0), (97.0, 1.0)] unfilled: 0.0 avg: 98.25
stop-limit: [(99.0, 1.0), (98.5, 2.0)] unfilled: 1.0 avg: 98.75
gap triggered: True
stop-market: [(96.0, 3.0), (95.0, 1.0)] unfilled: 0.0 avg: 95.75
stop-limit: [] unfilled: 4.0 avg: NoneIn the orderly book, the stop-market sells everything at 98.25. The stop-limit refuses the 97.0 level, so it sells 3 units at 98.75 and leaves 1 unit resting as an ask at 98.5. In the gap book, the stop-limit sells nothing. All 4 units sit at 98.5 while the best bid is 96.0, and the stop-market exits at 95.75.
Lifecycle of a stop order
Two states in this diagram are specific to stops. "Untriggered" holds no queue position and no reserved depth. Many venues do lock your balance for it, though. "Resting" applies only to stop-limits, and it is where the order can wait with no result.
Failure modes
Gaps and fast markets
Price does not move through every tick. When it jumps from above your trigger to well below it, the stop fires at the new price and not at the one you wrote. A stop-market sells at the best available bids. A stop-limit may not fill, as the simulation shows. Neither order guarantees the price you set as a trigger.
Stop hunting and wicks
A brief spike through a trigger fires the order, and price then recovers. You are out of the position at a bad price while the market goes back to where it was. A mark-price or longer-window trigger source reduces this risk. A wider stop distance reduces it too, at the cost of a larger loss when the stop is right.
Stop-limit that never fills
A stop-limit can leave you unprotected exactly when you need protection. If you use one for risk control, set the limit far enough below the trigger to cover plausible moves. A limit only 0.05% below the trigger covers little. Alternatively, accept that the order is only a partial safeguard.
Triggers and fees
A triggered stop-market pays the taker fee. A stop-limit whose limit is marketable also pays it. A stop-limit that rests and fills later pays the maker rate. Post-only is generally incompatible with stop orders that need to execute immediately. Check the venue's order-type matrix.
Balance and exchange rules
- Many venues reserve your balance when you place the stop, so you cannot sell the same coins twice.
- Orders on one exchange do not protect positions held on another.
- Triggers do not fire during exchange downtime or maintenance. Some venues do not guarantee the trigger fires while the matching engine is paused.
- On some derivatives venues, a stop can be set as reduce-only, so a late trigger cannot flip your position.
Choosing between them
| Priority | Better fit | Reason |
|---|---|---|
| Certainty of exit | Stop-market | Executes whatever the price |
| Price control | Stop-limit | Never worse than the limit, but may not fill |
| Deep, liquid pair | Either | The two behave similarly in normal conditions |
| Thin or volatile pair | Stop-market, with a wide stop | Stop-limit risks being stranded |
| Breakout entry | Stop-limit with a close limit | Avoids paying a spike |
Common errors
- Placing a sell stop above the current price. It triggers at once or is rejected, depending on the venue.
- Setting the stop-limit's limit above the trigger on a sell. The two prices are in the wrong order, and some venues reject it.
- Assuming a stop is on the book. It is not visible to other traders and has no queue priority until it triggers.
- Forgetting to cancel the paired order. If you hold a take-profit limit and a stop, one filling does not always cancel the other, unless you use an OCO (one-cancels-other) order and the venue supports it.
Exercise
A sell stop-limit has trigger 50.0 and limit 49.5, for 10 units. The price gaps down, the stop triggers, and the bids are (48.0, 6) and (47.5, 20). What happens, and what would a stop-market with the same trigger have done?
Show answer
The stop-limit becomes a limit sell at 49.5. Every bid is below 49.5, so nothing fills and all 10 units rest on the book as an ask at 49.5. A stop-market would have sold 6 units at 48.0 and 4 at 47.5, for a total of 288 + 190 = 478 and an average of 47.8, a full exit but 4.4% below the trigger.
Exercise
Why can a buy stop used as a breakout entry fire on a brief wick, and what setting on the exchange reduces the risk?
Show answer
A buy stop fires as soon as the reference price reaches the trigger, so a single trade through the level is enough, even if price immediately falls back. Using the mark price (or another source harder to move with one trade) as the trigger reference reduces this risk. A stop-limit with a limit close to the trigger also avoids paying for the spike.