Trailing stop loss for trading bots: how it works and how to set the distance
TopTradingBots editorial team · Published 19 Nov 2026 · Updated 19 Nov 2026 · Editorial policy
A trailing stop loss follows the price as it moves in your favor and stays put when price turns, closing the position once price falls back by a set distance from its best level. On bots you choose the distance (a percentage or fixed amount) and often an activation level that starts the trail. Too tight and normal swings close you out; too loose and you give back most of the move.
How a trailing stop loss works
A fixed stop loss sits at one price until you move it. A trailing stop loss moves by itself: it follows the price up on a long position, never moves back down, and closes the position once price falls a set distance from the best level it reached. FINRA’s order types page describes the stock-market version as telling your broker you want to sell “if your stock declines a certain percentage or dollar amount” from its market price. On a short, everything is mirrored: the stop follows the lowest price down.
Freqtrade’s stop-loss docs give a clean example. Buy at 100 with a 10% trailing stop and the stop starts at 90. Price rises to 102, and the stop moves to 91.8, 10% below the new high. Price slips to 101, and the stop stays at 91.8.
This guide is about the trail itself: its distance, when it starts, and when it helps or hurts. Where a stop belongs on grid, DCA and futures bots in the first place is covered in stop loss and take profit for trading bots.
Percent vs fixed distance
Exchanges and bot platforms let you set the trail in one of two ways:
| Setting | How the trigger is calculated (long) | Behavior |
|---|---|---|
| Percentage | Highest price × (1 − percentage) | Distance in dollars grows as price rises |
| Fixed amount | Highest price − fixed amount | Distance stays the same in dollars |
OKX’s strategy order guide uses exactly these two formulas and calls the setting the trail variance. Its example: with a 5% variance and a recorded high of 50,000 USDT, the trigger is 50,000 × (1 − 5%) = 47,500.
A percentage trail is the usual choice for crypto bots because it scales with price. A fixed amount can make sense when you size risk in dollars per unit, but after a large rally the same dollar gap becomes a much tighter percentage, and ordinary swings start to hit it.
Activation price: when the trail starts
Many trailing stops have a second setting: a level price must reach before trailing begins. OKX’s trailing stop help page says the stop “will only activate once the latest traded price reaches or exceeds the activation price”; without one, it activates immediately after the order is placed.
Bot platforms use their own names. 3Commas’ Signal Bot form guide splits it into Trigger P/L, the profit level after which the trailing stop becomes active, and Trailing Stop, the actual distance. It adds: “If the activation price is never reached, no stop level is applied.” Freqtrade does the same with trailing_stop_positive_offset and trailing_only_offset_is_reached, so the stop stays at its initial level until the trade is far enough in profit.
That last point matters. An activation level protects nothing below it. If you use one, keep an ordinary stop loss underneath for the case where price never gets there.
Trailing take profit and trailing in DCA bots
On DCA bots, trailing is mostly used on the exit, not as protection from entry.
- Trailing take profit. 3Commas’ DCA parameter guide says that when it is on, “instead of closing at the fixed target the bot lets profit run and trails a stop behind the peak.” A second setting controls how far price may retrace from its best level before the deal closes.
- Reference price. The DCA setup guide says the trailing stop is “based on the average price,” which moves as safety orders fill. It also says that if the stop loss and trailing stop share the same level, “the Stop Loss will take priority.”
- Trailing to breakeven. 3Commas’ stop loss breakeven option needs at least two take-profit targets. The stop trails until the first target fills, then moves to breakeven and trailing switches off. With both enabled, you cannot add funds to the deal by hand.
Grid bots trail differently: they move the range, not the stop. Bitsgap’s advanced grid settings say that with Trailing Up the grid moves up and the stop loss “becomes dynamic, following the lowest price as the grid moves upwards.” Trailing Down “does not move the grid but extends it,” buying with funds beyond the original investment, so it adds exposure rather than limiting it. Our grid bot settings guide covers ranges in more depth. Platform details are in our 3Commas, Bitsgap and OKX reviews.
Gaps, slippage and the fill you actually get
A trailing stop decides when to exit, not at what price. OKX’s strategy guide says that once the trailing stop triggers, “a market order will be placed,” and that it “might not be filled instantly.” FINRA’s Regulatory Notice 16-19 states that “stop prices are not guaranteed execution prices,” and that a sell stop hit in a steep decline is “more likely to result in an execution well below the stop price.” Choosing a limit order instead swaps that risk for another: FINRA notes a stop-limit may not execute at all.
Two consequences for bots:
- Thin pairs and big positions slip more. A market exit on a small-cap pair can walk down the order book.
- The trail does not see between prices. If price jumps from above the trigger to far below it, the stop fills wherever the market is.
Freqtrade’s docs also warn not to set a very tight stop when the stop is placed on the exchange, and flag the risk of stop-limit orders “especially in volatile markets.”
Choosing the trailing distance
The trail has to be wider than the pullbacks the market makes while it is still moving your way. Anything tighter closes good trades on noise.
Example, round numbers, not a recommendation: you enter a long at 100 and price climbs to 120 before reversing to 105.
| Trail | Stop when price peaks at 120 | Result on the reversal |
|---|---|---|
| 2% | 117.6 | Can be hit by an ordinary dip before the peak |
| 5% | 114 | Exits around 114, minus slippage |
| 10% | 108 | Exits around 108, giving back more of the move |
| Fixed stop at 90 | 90 | Still open at 105, profit not locked |
A way to pick a number:
- Look at the pair on the timeframe your bot trades and note the size of typical pullbacks during recent trends.
- Set the trail outside that range, and leave room for slippage on top.
- Backtest two or three distances on past data, including a sharp sell-off. Our backtesting guide explains how to avoid tuning to one lucky period.
- Decide whether you need an activation level, and keep a hard stop under it.
On futures, keep the hard stop well clear of liquidation. A trail does not help if leverage closes the position first.
When a trailing stop hurts
Trailing is not an upgrade on every bot. It tends to work against you when:
- The market is ranging. Price swings back and forth inside a range, and a trail keeps closing positions at the bottom of each swing. A grid bot is built for that market and a trail fights it.
- The trail is inside normal volatility. You trade more, pay more fees, and miss the move you entered for.
- It replaces averaging. On a DCA bot, a trailing stop that fires before safety orders fill cuts the plan short. 3Commas warns that a DCA stop inside the safety-order ladder triggers before the deepest orders can fill.
- Activation is never reached. The position has no trailing protection at all, as 3Commas notes.
- You trust the trigger as an exit price. In a gap, the fill can be far below it.
A trailing stop is a tool for trends. Use it where you expect a trend, size the position so the hard stop below it is affordable, and see trading risk management for the account-level limits that sit above any single bot.
FAQ
What is a good trailing stop percentage?
There is no single good number. The distance has to be wider than the ordinary pullbacks of the pair on the timeframe your bot trades, or normal noise will close the trade. Measure recent pullbacks, test a few distances in a backtest, and accept that a wider trail gives back more on reversals.
What is the activation price on a trailing stop?
It is the level price must reach before the trail starts following it. OKX says that if you leave the activation price empty, the trailing stop activates as soon as the order is placed. 3Commas' Signal Bot calls the same idea Trigger P/L and says no stop level is applied if it is never reached.
Is a trailing stop the same as a trailing take profit?
They use the same mechanism but have different jobs. A trailing take profit starts once a profit target is reached and lets the winner run. A trailing stop loss can start from entry and protects the position from the start. On 3Commas DCA bots the trailing take profit closes the deal after a set pullback from the peak.
Does a trailing stop guarantee the exit price?
No. OKX places a market order once its trailing stop triggers and says it might not be filled instantly. FINRA notes stop prices are not guaranteed execution prices, and in a fast drop the fill can land well below the trigger.
Sources
- FINRA — Order Types ↗checked 18 Nov 2026
- FINRA — Regulatory Notice 16-19 ↗checked 18 Nov 2026
- OKX — Strategy order types (trailing stop) ↗checked 18 Nov 2026
- OKX — How do I place a trailing stop order? ↗checked 18 Nov 2026
- 3Commas — 3Commas DCA Bot for TradingView: Setup & Parameter Guide ↗checked 18 Nov 2026
- 3Commas — How the DCA Bot Works: Strategy & Setup Guide ↗checked 18 Nov 2026
- 3Commas — DCA Bot: Stop loss breakeven ↗checked 18 Nov 2026
- 3Commas — Signal Bot: Comprehensive Form Guide ↗checked 18 Nov 2026
- Bitsgap — Customize Advanced Bitsgap GRID Bot Settings ↗checked 18 Nov 2026
- Freqtrade — Stop Loss ↗checked 18 Nov 2026
Related guides
- Trading bots in a bear market: how each bot behaves when prices keep falling
- Trading bot strategies: how each one earns, when it loses, who offers it
- Are crypto trading bots profitable? What actually decides the result
- Grid vs DCA bot: which one fits your market, fees and budget
Not financial advice. Trading bots do not remove market risk.