The core idea of this strategy is to dynamically adjust the position size of each trade based on account equity. It can automatically increase position size when profitable and decrease position size when losing, thereby achieving the automatic leverage effect of compounding.
The strategy achieves dynamic position sizing through the following key steps:
The above steps ensure reasonable position sizing, avoid over-leverage risks, while linking size to equity to achieve auto-compounding as profits increase.
The strategy has the following advantages:
There are also some risks:
Risks can be mitigated through prudent parameter settings, capital buffering etc.
The strategy can be enhanced in the following ways:
The above enhancements can make the strategy behavior more stable and controllable, avoiding sensitivity and frequent position size changes.
The strategy achieves equity-based dynamic position sizing to automatically magnify profits. It sets leverage and max size as risk controls, with simple and clear logic for ease of understanding and customization. We also analyzed its pros and cons and risks, along with some optimization suggestions. Overall, it provides a flexible and practical approach to achieve automated compound growth in trading.
/*backtest start: 2024-01-01 00:00:00 end: 2024-01-31 23:59:59 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of Tendies Heist LLC, 2021 //@version=4 strategy("Tendies Heist Auto Compounding Example", overlay=true) leverage = input(10000) maxps = input(25, "max position size") strategy.risk.max_position_size(maxps) balance = max(1,floor(strategy.equity / leverage)) o = 1 ps = true size = 0. balance2 = size[1] < balance balance3 = size[1] > balance l = balance3 w = balance2 if ps size := w ? size[1]+o : l ? size[1]-o : nz(size[1],o) if size > maxps size := maxps longCondition = crossover(sma(close, 14), sma(close, 28)) if (longCondition) strategy.entry("My Long Entry Id", strategy.long,qty=size) shortCondition = crossunder(sma(close, 14), sma(close, 28)) if (shortCondition) strategy.entry("My Short Entry Id", strategy.short,qty=size)