Trailing Stop for Binance Futures USDS-M and COIN-M
We continue to explore tools that facilitate trading on cryptocurrency exchanges. Let's take a look at how the Trailing Stop mechanism works from revenuebot.io.
What is a Trailing Stop and what is it for?
A trailing stop (also known as trailing take profit) is used to maximize income. It replaces the classic limit take-profit order. The essence of the mechanism is that you do not have to set a take-profit order immediately after opening a position, but can wait for a better price and earn more by tracking price changes. Literally, Trailing Stop translates to "tracking stop." When setting a trailing stop order, the concept of stop price comes into play; this is the price at which the position will be closed. The stop price initially stands at a specified percentage deviation from the activation price of the trailing stop and will change (be pulled up) in the direction of increasing income following the current market price. As a result of the trailing stop mechanism, the position will close when the price reaches the most favorable level during the entire tracking period, minus the percentage deviation.
How does it work? The trailing stop mechanism has two settings:
- Activation price (set by the bot's "Profit %"). This will be the price at which the trailing stop mechanism is activated, determining the first stop price and starting the tracking of further price changes.
- Percentage deviation (set by the bot's "Deviation Percentage"). This sets the pull-up of the stop price. When the current price on the exchange continues to rise towards increased profit, the stop price also changes, following the current price at a distance of the percentage deviation. However, this process is not infinite, and when the current price on the exchange reverses and starts to decrease, at some point it will equal the stop price, at which moment a market order will trigger and the position will close.
Thus, if after opening a position with the bot the price moves towards profit, upon reaching the activation price, a trailing_stop_market order will be placed by the bot on the exchange. From then on, the functionality of triggering this order is entirely under the control of Binance. The exchange begins tracking price changes.
For the LONG algorithm - upon reaching the maximum price and subsequent price change in the opposite direction by the specified percentage deviation in the settings, a market sell order will be sent by the exchange, and the position will be closed.
For the SHORT algorithm - upon reaching the minimum price and subsequent price change in the opposite direction by the specified percentage deviation in the settings, a market buy order will be sent by the exchange, and the position will be closed.
After such a market order is triggered, the bot will calculate the profit based on the average price at which the order was triggered and will complete the current cycle of operation.
Let's consider an example with numbers to see how the trailing stop mechanism works?
We will analyze the principle of operation of the Trailing Stop using the BTC/USD trading pair as an example. Suppose we opened a LONG position, buying 1 BTC at a price of 10,000 USD. After opening the position, we set a trailing stop order with an activation price of 5% and a deviation percentage of 1%. The table below shows how the trailing stop will work.
BTC Price | Stop Price | Trailing Stop Status | Comment |
$10300 | not set | Trailing Stop not active | The price has risen but has not reached 5% for the trailing stop mechanism to activate |
$10500 | $10395 | Trailing Stop active | The price reached 5%, the mechanism activated, and the stop price was set. 10500-1%=10395 |
$10400 | $10395 | Trailing Stop active | The price decreased but did not reach the stop price to complete the tracking mechanism with a market order. The stop price itself does not change. |
$10500 | $10395 | Trailing Stop active | The price increased but did not update the maximum, so the stop price also does not change. |
$10600 | $10494 | Trailing Stop active | The price increased and updated the maximum since tracking began, the stop price is pulled up accordingly. 10600-1=10494 |
$10800 | $10692 | Trailing Stop active | The price increased and again updated the maximum since tracking began, the stop price is pulled up again. 10800-1%=10692 |
$10700 | $10692 | Trailing Stop active | The price decreased but did not reach the stop price to complete the tracking mechanism with a market order. The stop price itself does not change. |
$11000 | $10890 | Trailing Stop active | The price increased and again updated the maximum since tracking began, the stop price is pulled up again. 11000-1%=10890 |
$10900 | $10890 | Trailing Stop active | The price decreased but did not reach the stop price to complete the tracking mechanism with a market order. The stop price itself does not change. |
$10600 | $10890 | Stop Loss triggered | The price decreased further and became less than the stop price, triggering a market order and closing the position at an average price of approximately $10700 |
The example in the table shows a possible price change on the exchange where the position closed at a price of $10700, resulting in a profit of 7%, which is higher than if we had simply used a limit take profit order with a target profit of 3%.
How to enable Trailing Stop in the bot?
To enable the trailing stop functionality, you need to create/edit the bot and perform three actions:
- In the main settings, set the desired profit percentage "Profit (%)", which will serve as the activation price for the trailing stop.
- Activate the checkbox "Trailing Stop”.
- Set the "Deviation Percentage".
Recommendations for configuring the Trailing Stop mechanism.
The trailing stop can increase income when the price moves towards profit and continues this movement, but it is important to understand that by using this mechanism, you may miss the only opportunity to gain profit in the current cycle of the bot's operation, as the current price after reaching the activation price of the trailing stop may move in the opposite direction, resulting in a loss, whereas using a regular limit take-profit order could have yielded a profit here.
If you decide to use the trailing stop mechanism, we recommend setting the activation price "Profit (%)" slightly higher than what you used for a regular limit take-profit order.
Choose the deviation percentage such that you remain in profit when executing the trailing stop if the current price on the exchange changes towards a loss after reaching the activation price.