Dynamic Take Profit and Stop Loss

Instead of setting static percentages for take profit and stop loss, the bot can constantly monitor the market situation and set the targets dynamically.

The mechanism involves 2 key elements, the measurement of volatility and the moving average.

Dynamic Take Profit

The volatility is measured by ATR (which is a technical analysis indicator originally developed by J. Welles Wilder, Jr.), and gives an absolute value that indicates the price could possibly range within in the near future.

There is a selection of moving average types like MA, EMA or KAMA can be chosen from.

And the proportion of volatility and moving average is used to set up the take profit target. Here is an example:

If the bot bought 10 BTC at the price of 1000 USD, and the ATR is configured to "1 day, 14 periods", and EMA is also configured to "1 day, 14 periods", the bot will update the take-profit target daily.

Suppose next day, the ATR of BTC/USD is 50 which indicates the price could go up or down by 50 USD, and the EMA is 1005 USD, then 50 / 1005 = 4.97% will be set as the take-profit target.

On top of that, there is an ATR Factor can be used to make fine tuning, for example, if ATR Factor is set to 50%, that means for scenario mentioned above, it will set profit target to (50 * 50%) / 1005 = 2.48% which secures the profit sooner.

Trailing works in a similar way to the static setup, it just gets updated dynamically, for example, if trailing ATR Factor sets to 25%, the bot will place the order until the price retracts from the peak price by (50 * 25%) / 1005 = 1.24%

Dynamic Stop Loss

Similar to Dynamic Take Profit, it is based on ATR and moving average, but different from the static setup, it DOES NOT use percentage, it uses an absolute value instead, and no trailing. Here is an example:

If the bot bought 10 BTC at the price of 1000 USD, and the ATR is configured to "1 day, 14 periods", and EMA is also configured to "1 day, 14 periods", the bot will update the stop loss daily.

Suppose the next day, the ATR of BTC/USD is 50 which indicates the price could go up or down by 50 USD, and the EMA is 1005 USD, then 1005 - 50 = 955 USD will be set as the stop loss.

On top of that, if ATR Factor is set to 150%, then the stop-loss will be set to 1005 - (50 * 150%) = 930 USD

Last updated

Was this helpful?