Trailing-stop orders are orders that follow the price as it moves in a positive direction.
If the price reverses in a negative direction by a specified percentage of deviation, the trailing-stop will close the trade at the market price.
For Long positions, trailing-stop orders help to maximize the selling price of the asset, while for Short positions they help to minimize the buying price. In other words, trailing-stop is relevant for both long and short bots.
Currently, trailing is supported for Binance and OKX exchanges.
Let’s look at the Long example
At 12:01, when the asset price is 40,000, the bot placed a trailing-stop order for take profit at the activation price of 42,000 (stopPrice on the chart), with a deviation percentage of 7.5%.
Between 12:01 and 12:02, a series of trades pushed the asset price up to 41,500.
Between 12:02 and 12:03, a series of trades caused the asset price to decrease to 39,000.
A series of trades between 12:03 and 12:04 results in an increase in price. When the asset price reaches or crosses the activation price of the trailing stop order (stopPrice), the order starts to follow the price change. The first trade that satisfies this condition sets the “highest price”. In this case, the highest price is 42,000. And if the price deviates downward by 7.5% from it, the order will be executed.
Next, a series of trades causes the price to increase to 45,000, which updates the “highest price”. Now, for the trailing stop order to execute, the price needs to deviate down 7.5% from 45,000.
Between 12:04 and 12:05 brings the price down to 44,000. That’s about 2.2% – not enough to execute the order.
Between 12:05 and 12:06, trading raises the price to 46,500. This is again above the previous high, which updates the highest price. And now the execution price of the trailing stop order is: 46 500 * (100 – 7.5) / 100 = 43 012,5.
Trading between 12:06:00 and 12:06:50 causes the price to fall to the price of 43,012.5. The trailing stop order reacts to this event by executing the order.
Thus, the initial take profit at the price of 42,000 closed at the price of 43,012.5.