Sub topic 15
A preview of stop and stop-limit orders
This chapter assumes you have read the chapters on market orders, limit orders, time in force and order statuses. You should know that a market order trades fill certainty for price uncertainty, and that a limit order does the reverse. Stop orders build on both. This is a preview. It gives you the working model and the common errors, not a full risk-management system. It is educational material, not investment advice.
What a stop order is
A stop order is a dormant order with a trigger. It does nothing while the market trades on the near side of a price you chose, called the stop price. When the market trades through that price, the order wakes up and turns into a different order. Until then it is not on the order book, so nobody else can see it.
There are two common forms:
- A stop order (also called stop-market) turns into a market order when triggered.
- A stop-limit order turns into a limit order when triggered. It needs two prices: the stop price and the limit price.
The direction of the trigger depends on the side:
- A sell stop sits below the current price. It triggers when the price falls to the stop price or lower. People use it to exit a position they already own if it drops.
- A buy stop sits above the current price. It triggers when the price rises to the stop price or higher. People use it to enter on strength, or to close a short position.
A common error is to treat a stop as a limit order. A sell stop at 49.50 does not mean "sell at 49.50". It means "start trying to sell once the price reaches 49.50".
Stop-market: the exit happens, the price is open
After the trigger, a stop-market order behaves like any market order. It takes whatever the book offers, so it inherits the slippage you saw earlier. In a calm, liquid stock the fill is usually close to the stop price. In a fast market it can be far away.
There are two reasons the fill can be worse than the stop price:
- Thin depth. The stop triggers, but the best bid holds only a few shares, so your order walks down the book.
- A gap. The stock closes at 50.10 and opens the next day at 48.00 after bad news. A sell stop at 49.50 triggers at the open and fills near 48.00. The stop price was never available to trade.
Stop-limit: the price is capped, the exit is not guaranteed
A stop-limit order puts a limit price on the order that the trigger creates. A sell stop-limit with stop 49.50 and limit 49.30 means: "if the price reaches 49.50, place a limit order to sell at 49.30 or better."
This protects you from selling at a terrible price, but it carries the same risk as every limit order. If the market drops past 49.30 without trading there, the order sits unfilled while the price keeps falling. You then still own the stock, which is the outcome the stop was meant to prevent.
The following diagram shows the path of each order type after you submit it.
Comparing the four order types
| Order type | Becomes active | Price control | Fill certainty |
|---|---|---|---|
| Market | Immediately | None | High |
| Limit | Immediately | Limit price caps your price | Not guaranteed |
| Stop (stop-market) | When the stop price trades | None after the trigger | High after the trigger |
| Stop-limit | When the stop price trades | Limit price caps your price | Not guaranteed |
Simulating a trigger
The code below extends the fill logic from earlier in the chapter sequence. It finds the first price that triggers a sell stop, then fills against a list of bids. It runs the same scenario as a stop-market and as a stop-limit.
def first_trigger(prices, stop, side):
"""Return the index of the first price that triggers the stop, or None."""
for i, p in enumerate(prices):
if (side == "sell" and p <= stop) or (side == "buy" and p >= stop):
return i
return None
def fill_sell(bids, qty, limit=None):
"""Sell into (price, size) bids. limit=None acts like a market order."""
filled, proceeds = 0, 0.0
for price, size in sorted(bids, reverse=True):
if limit is not None and price < limit:
break
take = min(size, qty - filled)
filled += take
proceeds += take * price
if filled == qty:
break
avg_price = round(proceeds / filled, 4) if filled else None
return filled, avg_price
prices = [50.10, 49.90, 49.60, 49.20, 48.70] # last-trade prices over time
bids = [(49.10, 100), (49.00, 100), (48.80, 200)] # book after the trigger
idx = first_trigger(prices, stop=49.50, side="sell")
print("triggered at index", idx, "price", prices[idx])
print("stop-market:", fill_sell(bids, 150))
print("stop-limit :", fill_sell(bids, 150, limit=49.30))The output is:
triggered at index 3 price 49.2
stop-market: (150, 49.0667)
stop-limit : (0, None)The price fell from 49.60 to 49.20 between two trades, so it skipped over 49.50. The stop-market sold all 150 shares at an average of about 49.07, which is 0.43 below the stop price. The stop-limit sold nothing, because every bid was below its 49.30 limit. Neither result is wrong. Each order did what its rules said.
Choosing a limit price on a stop-limit
The gap between the stop price and the limit price is the main design choice:
- A narrow gap (limit very close to stop) gives tight price control but a higher chance of no fill.
- A wide gap gives a better chance of a fill but allows a worse price. In the extreme it behaves like a stop-market.
For a sell stop-limit, the limit is at or below the stop. For a buy stop-limit, the limit is at or above the stop. If you reverse this, the order may trigger and then never be marketable in the way you meant.
Common errors and gotchas
- Assuming a guaranteed exit. A stop-market usually exits, but at an unknown price. A stop-limit controls price but may not exit. No stop order guarantees both.
- Setting the stop too close. Normal price movement during a day can trigger a stop that is only a few cents away, and you sell a position you wanted to keep.
- Ignoring what triggers it. Brokers differ. Many trigger on the last traded price, but some use the bid or ask, and some allow you to choose. Check your broker's documentation.
- Overlooking sessions. Many brokers do not trigger stops outside regular hours, or they handle them differently. Read the extended-hours rules before relying on one.
- Forgetting time in force. A day stop order expires at the close. A good-til-canceled (GTC) stop stays active, so you may forget it and later find it triggered or still sitting there.
- Forgetting that a triggered stop-limit is a live limit order. It shows up in your order list as open or partially filled. You must cancel or modify it like any other limit order.
Using this in your pre-trade checklist
For your first trades, a plain market or limit order is enough. If you add a stop order to protect a position, confirm four things before submitting: the side (sell stop below the price, buy stop above), the stop price, the limit price if there is one, and the time in force. Then ask what happens if the stock gaps through both prices.
Exercise
You own 100 shares trading at 40.00. You place a sell stop-limit with stop price 38.00 and limit price 37.50. Overnight, bad news causes the stock to open at 36.00 and trade down from there with no trades at or above 37.50. What happens to your order, and what would a plain sell stop (stop-market) at 38.00 have done?
Show answer
The open at 36.00 is below the 38.00 stop, so the stop-limit triggers and becomes a limit order to sell at 37.50 or better. No trades occur at 37.50 or higher, so it stays open and unfilled, and you still own all 100 shares. A stop-market at 38.00 would have triggered at the same moment and become a market order, so it would have sold near 36.00. That is a worse price than the stop, but it would have exited the position.
Exercise
Using the code in this chapter, you change the stop-limit's limit price from 49.30 to 49.00 while keeping the same prices and bids. How many shares fill and at what average price? Why does this order differ from the 49.30 case?
Show answer
The bids at 49.10 (100 shares) and 49.00 (100 shares) are at or above the 49.00 limit, so 100 shares fill at 49.10 and 50 shares fill at 49.00. The average is (100 x 49.10 + 50 x 49.00) / 150 = 7360 / 150, about 49.0667. This matches the stop-market result because the 150 shares fit entirely inside bids at or above 49.00. The limit of 49.30 was above every bid, so nothing filled. A wider gap between stop and limit raised the chance of a fill.