Trailing stop bot

Updated

A fixed take profit decides in advance how much of a move you keep. A trailing stop lets the market decide: the stop loss follows the price while the trade goes your way and closes the position when the move turns. Algonney gives every strategy a set of exits that work together: trailing stops, partial take profit, time exits and session-end exits, on top of the stop loss every strategy must have.

Two ways to trail

R ladder

R is the distance between your entry and your first stop loss. An R ladder moves the stop in steps of R:

  • When the trade reaches the start level, the stop moves to the entry, so the trade can no longer lose its full risk.
  • After that, each time the price moves another step, the stop moves up by one step, staying a set number of R behind.

The R ladder suits strategies whose stop comes from the chart, such as the low of the signal candle. The steps scale with the risk of each trade by themselves.

Percent trail

A percent trail keeps the stop a fixed percent behind the best price since entry: the highest price for a long, the lowest for a short. You can add an activation level, as a percent or in R, so the trail only starts once the trade has moved that far in your favour. Until then the original stop loss stays in place.

How a trailing move is applied

The trailing logic runs in the guard, the part of the platform that watches every position and cannot be turned off. On Bybit USDT perpetuals the trailing stop runs natively on the exchange. On other markets the guard sends each move to the exchange as an update of the stop order. A move is applied only after the exchange confirms it, and the stop never moves backward. You choose which price triggers stops and trailing steps when you set up a bot.

Partial take profit

Instead of one take profit, a strategy can close the position in parts, each at its own distance from the entry in R or in percent, nearest first. The parts' shares add up to at most the whole position. What is left exits by the stop loss, the trailing stop or the strategy's exit rule. A strategy uses either a single take profit or parts, not both.

In live trading, partial take profit runs only on Bybit USDT perpetuals. There the exchange-side stop loss always covers the whole open position, so it follows every partial exit and protects exactly what is left. The parts are sent by the guard as reduce-only orders. On other live markets a strategy with partial take profit is refused.

Time exit

A time exit closes a position once it has been open for a set number of candles of the strategy's timeframe. You can add a profit condition: the time exit then closes the trade only when its profit at the candle close is at least the level you choose, or at least break-even. Below that level, the position stays open with its stop loss and take profit. Time exits stop capital from sitting in trades that go nowhere.

Session-end exit

A strategy can close every position at the end of the trading session it was opened in. This is useful for intraday strategies built around one session. These are the sessions you can use:

SessionWhen
asiaAsia/Tokyo 09:00–15:00, mon,tue,wed,thu,fri
londonEurope/London 08:00–16:30, mon,tue,wed,thu,fri
new_yorkAmerica/New_York 09:30–16:00, mon,tue,wed,thu,fri
london_killzoneAmerica/New_York 02:00–05:00, mon,tue,wed,thu,fri
new_york_killzoneAmerica/New_York 07:00–10:00, mon,tue,wed,thu,fri

Cooldown after an exit

After a position on a symbol closes, a cooldown can wait a number of candles before the bot opens a new trade on that symbol, on either side. This keeps a strategy from jumping straight back into the market that just stopped it out.

Every exit is recorded

Each closed trade shows why it closed: stop loss, take profit, trailing stop, time exit, session end, the strategy's exit rule, STOP ALL, a manual close, a guard close or a liquidation. The same reasons appear in backtests, paper bots and live bots, so you can see which exit does the work in your strategy and compare test results with live ones.

Build it by chat

You do not need to write code to use these exits. Describe them to Jarvis, the AI assistant, for example "trail the stop by one R once the trade is two R in profit, and close anything still open at the end of the session". Jarvis turns that into the strategy's rules, and you check them on the strategy card before you save. See the crypto strategy builder.

Test it first

A trailing stop that looks good on one chart can give back more than it keeps on another. Run a backtest on real history first: the engine reads one-minute candles inside each bar to decide whether the stop or the target was hit first. Then run the strategy as a paper bot on live prices before you go live.

The bots guide in the docs explains how exits appear on a running bot, and Plans and pricing shows the limits of each plan.

Related pages

Trailing stops can close a trade early and still lose money after fees. Read the risk disclosure before you trade live.

Past results do not guarantee future returns.

Questions and answers

What is a trailing stop bot?

It is a trading bot whose stop loss follows the price as a trade moves in your favour. The stop only moves in one direction, toward profit, so part of the gain is protected while the trade can keep running.

How does a trailing stop work in crypto trading?

You choose how far behind the best price the stop should stay, as a percent or in steps of R, the distance between entry and the first stop loss. When the price makes a new high for a long, or a new low for a short, the stop moves with it. When the price turns and reaches the stop, the position closes.

Can I use partial take profit on Binance or OKX?

Not in live trading. In live trading, partial take profit runs only on Bybit USDT perpetuals, where the exchange-side stop loss follows the position after each partial exit. On other live markets a strategy with partial take profit is refused.

Does the trailing stop ever move back?

No. A trailing move is applied only after the exchange confirms it, and the stop never moves backward. If a move cannot be confirmed, the last confirmed stop stays in force.

What is a time exit?

A time exit closes a position after it has been open for a number of candles of the strategy's timeframe. You can make it close only when the trade is at or above a chosen profit; below that, the position stays with its stop loss and take profit.