Trailing stop strategy: let winners run without giving it back
A fixed take-profit caps your winner; a trailing stop lets it run. A trailing stop is a stop-loss that moves up behind a rising position (and never down), so it locks in more profit as price climbs and exits automatically when the move finally reverses. It is the single best exit for trend and momentum bots, where the whole edge comes from catching the rare large move. The catch is the trade-off: trail too tight and normal noise stops you out early; trail too loose and you hand back a chunk of the gain. This guide explains how trailing stops work, fixed-percent versus ATR-based trailing, and the exit code.
What a trailing stop is
A trailing stop is a stop-loss that ratchets in your favour. On a long, it sits a set distance below the highest price reached since entry; every time price makes a new high, the stop steps up with it, but it never moves back down. The result is an exit that gives the trade room to breathe while quietly banking profit — you stay in as long as the trend holds and get taken out the moment it turns.
How it tracks price
Because the stop only moves up, your worst case improves with every new high. Once price has run far enough the trailing stop is above your entry — the trade is now risk-free and the only question is how much profit you keep.
Fixed-percent versus ATR-based trailing
A fixed-percent trail (e.g. 5% below the high) is simple but ignores volatility — too tight for a choppy coin, too loose for a calm one. An ATR-based trail (a multiple of the Average True Range below the high, the “chandelier exit”) adapts to the market: it widens when volatility rises and tightens when it falls, so normal noise does not clip you. ATR trailing is the more robust choice for most trend bots.
The trailing-stop code
python · trailing_stop.pyatr = average_true_range(candles, 14)
peak = max(peak, price) # highest price since entry
trail = peak - 3*atr # chandelier: 3 ATR below the peak
if price <= trail:
ex.close('trailing-stop') # move reversed, bank the gain
The whole logic is in two lines: track the peak, keep the stop a volatility multiple beneath it. Note the stop is derived from peak, never from the current price, so it can only ratchet up.
The whipsaw trade-off
A tight trail banks more of each winner but stops you out on routine pullbacks, turning a would-be trend trade into a scratch. A loose trail rides the trend through its noise but hands back a large slice when it reverses. There is no setting that does both — backtest the trail multiple on the backtester across many trades and pick the value that maximises net expectancy, not the one that looks best on a single chart.
When to use a trailing stop
Use a trailing stop on trend, breakout and momentum strategies, where a few large winners carry the whole edge and a fixed target would cap them. Skip it on high-win-rate mean-reversion trades that aim for a small, defined move — there a fixed take-profit is cleaner. Always pair the trail with an initial hard stop in case the trade goes wrong before it ever moves into profit, and size from that initial stop with the position calculator.
Frequently asked questions
What is a trailing stop?
A trailing stop is a stop-loss that moves up behind a rising position and never moves back down, so it locks in more profit as price climbs and exits automatically when the move reverses. On a long it sits a set distance below the highest price reached since entry, giving the trade room to run while banking gains.
What is the difference between a fixed-percent and an ATR trailing stop?
A fixed-percent trail sits a constant percentage below the high and ignores volatility, so it can be too tight in choppy markets and too loose in calm ones. An ATR-based trail (a chandelier exit) keeps the stop a multiple of the Average True Range below the high, widening in volatile conditions and tightening in quiet ones, which makes it more robust.
When should a bot use a trailing stop instead of a take-profit?
Use a trailing stop on trend, breakout and momentum strategies, where a handful of large winners carry the edge and a fixed target would cut them short. A fixed take-profit is better for high-win-rate mean-reversion trades that aim for a small, defined move and do not need to ride a long trend.
What is the downside of a trailing stop?
The trade-off is unavoidable: a tight trail banks more of each winner but gets stopped out by normal pullbacks, while a loose trail rides the trend but hands back a chunk on reversal. No setting does both, so the trail distance must be backtested across many trades to maximise net expectancy rather than tuned to one nice-looking chart.