What is the automatic flipping of an algorithm and what is it for?
Depending on certain conditions, the bot can stop the current active cycle, cancel all active orders, including take-profit orders, and then transfer the deposit it was operating with to another bot (that has the opposite algorithm) and run it.
An automatic flip of the bot algorithm can be useful in an aggressive strategy of trading reliable coins, and also to ensure that the bot deposit does not wait for the right price on the exchange. In addition, this mechanism is useful for reducing possible losses when the bot gets into the "Investor" situation, when all orders of the grid are executed and the price continues to move away from the price of the take profit order.
An example of using the automatic flipping of an algorithm
Let’s take an original BTC deposit and an ETH-BTC trading pair with the LONG algorithm (ETH will be purchased for BTC if ETH falls). ETH is a large and reliable coin with large capitalization, trading volumes, etc. Based on this, it can be assumed that with an initial deposit in BTC, it is not worrying if it is temporarily traded in the LONG algorithm for ETH. As a result, for such a trading pair it is possible to set very aggressive trading settings (small percentage overlap of price change) to make a better profit. However, aggressive trading settings can lead to the execution of all grid orders. In this case, it is possible to automatically flip the algorithm for it to operate in the opposite direction in order to not have to wait for the return of the price and for the deposit to not be inactive, so that the trading can continue and generate a profit. This means that the LONG bot in the ETH-BTC pair will be stopped, and the deposit from its work will be transferred to the SHORT bot in the same trading pair (ETH will be sold for BTC when the price of ETH increases). In this situation, it is important to set less aggressive settings for the new bot when flipping the algorithm, which will allow you to stay in the black if all the grid orders are executed again.
How do I enable the automatic flipping of the algorithm, what do I need to do?
To reverse the algorithm, you need to create a bundle of two bots. The bundle consists of the primary bot that will operate first, and of the bot that is assigned to it for flipping. First one bot works, then another. Both bots must be created for the same exchange and trading pair. The bots’ algorithms must be opposite.
The wallet of the primary bot must match the initial deposit in the account on the exchange.
The wallet of the second bot can be created with a balance of zero, and the amount will be automatically changed when the flipping mechanism is triggered. By default, the amount of funds available in the second bot's wallet consists of the deposit received from the executed orders of the primary bot, to which is added the deposit remaining in the flipped bot during the previous flip of the algorithm, if there was one. The wallet of this bot can be formed without taking into account the deposit remaining in the flipped bot during the previous flip of the algorithm. To learn how to set this up, read more about it below in the conditions and settings of the automatic flipping of the algorithm.
Important: Bot wallets that have the automatic algorithm switching enabled should not be interest-bearing. You need to use only those wallets where a specific amount is specified for use.
Note that in the settings of the bot that is assigned to flip, you can also assign your own bot to flip and it can be the primary bot. In this way, you can create a flip that goes in a circle between two bots, or create a chain of bots to flip the algorithm. To enable the automatic flipping of the algorithm, you need to activate the checkbox "Enable automatic flipping of the algorithm" in the bot settings and select the bot that will be launched when the flipping mechanism is triggered.
Important: You only need to run the primary bot, the flipped bot will be launched automatically after the primary bot is stopped.
Important: Simulation mode is not available for bots with the automatic flipping of the algorithm enabled.
What are the conditions and settings for triggering the automatic flipping of the algorithm and how to set them?
The automatic flipping of the bot algorithm is triggered by default when all grid orders are executed, but you can also set other conditions for this mechanism to be triggered.
- 1. All the grid orders were executed and the price continued to fall from the price of the last order on the specified percentage.
In this case the follow-up of the price change begins after all the grid orders have been executed.
- In the case of the original LONG algorithm if the whole grid of insurance orders is executed and the price has continued to decrease from the price of the last order in the grid for the required percentage, cancel the take-profit order of the current cycle, transfer the remaining deposit from this order to the designated SHORT Flip Bot and then launch it. Trade will continue in the opposite direction.
- In the case of the original SHORT algorithm, if the entire grid of safety orders is executed and the price continues to increase from the price of the last order in the grid by the desired percentage, cancel the take-profit order of the current cycle, after which transfer the remaining deposit from this order to the LONG bot designated for flipping and then launch it. Trade will continue in the opposite direction.
This condition for the automatic flipping of the algorithm can be configured in the bot settings, namely in the bot start filters. The name of the filter for starting the bot is "Flipping the algorithm: Last order executed & % Price change".
- 2. The price has changed by the specified percentage of the price of the first order in the grid.
In this case, it doesn’t matter how many orders are executed. When the current price is removed by the desired percentage from the price of the first order in the grid, all active orders in the cycle will be cancelled, and the algorithm will be reversed.
- In the case of the original LONG algorithm, if the price has decreased from the price of the first grid order by the desired percentage, cancel all the active orders of the current cycle, including the take-profit order, transfer the remaining deposit from this order to the SHORT bot designated for flipping and then launch it. Trade will continue in the opposite direction.
- In the case of the original SHORT algorithm, if the price increased from the price of the first grid order by the desired percentage, cancel all the active orders of the current cycle, including the take-profit order, transfer the remaining deposit from this order to the LONG bot designated for flipping and then launch it. Trade will continue in the opposite direction.
This condition for the automatic flipping of the algorithm can be configured in the bot settings, namely in the bot start filters. The name of the filter to start the bot is "Flip the algorithm: % price change".
- 3. The bot cycle lasts longer than the specified time.
You can set the time (in hours) after which, if there are completed orders in the active cycle of the bot and a take-profit order has been placed, the algorithm will be reversed. The time is calculated from the start of the cycle.
This condition for the automatic flipping of the algorithm can be configured in the bot settings, namely in the bot start filters.The name of the starting filter of the bot is "Inverting the algorithm: Cycle duration in hours".
- 4. The cycle of the bot after placing a fixing order (take-profit) lasts longer than the specified time.
You can set the time (in hours) after which, if there are completed orders in the active cycle of the bot and a take-profit order is placed, the algorithm will be reversed. The time is calculated from the moment of placing a fixing order (take-profit).
This condition for the automatic flipping of the algorithm can be configured in the bot settings, namely in the bot start filters. The name of the starting filter of the bot is "Inverting the algorithm: Cycle duration in hours from fixing order".
- 5. Setting up the formation of the bot's wallet for flipping.
When the algorithm is reversed, the remaining total of the wallet of the flipped bot is calculated. It consists, by default, of a deposit received from executed orders of the primary bot, to which is added the deposit left by the flipped bot in the previous flip of the algorithm, if there was one. If this filter is enabled, the deposit left by the flipped bot during the previous flip of the algorithm will not be counted in these calculations. To enable this filter, set it to = 1.
This condition for the automatic flipping of the algorithm can be configured in the bot settings, namely in the bot start filters. The name of the filter to start the bot is "Flip the algorithm: Do not use the deposit balance from the previous flip".