This strategy observes price oscillation around long-period moving averages (e.g. 200-day) to determine hold signals, trading breakouts for position entry and using break below as stop loss. It aims to minimize trading frequency for long-term holding.
Strategy Logic:
Calculate a long-period moving average, typically 200-day.
Enter long when price breaks above the moving average.
Exit long when price breaks back below the moving average.
Hold long position until break below stop loss.
Advantages:
Long-period MA effectively identifies mid-to-long term trends.
Breakout trading captures long-term reversals in a timely manner.
Lower trading frequency reduces costs and risks.
Risks:
Longer MAs lag significantly, resulting in poor entry timing.
No limit on post-breakout drawdown risks.
Frequent minor breakouts bring sustained small losses.
In summary, this HODL strategy uses long MA oscillation to determine hold timing, minimizing trade frequency. But parameter optimization and stop loss placement could improve performance and risk control for steady long-term gains.
/*backtest start: 2022-09-05 00:00:00 end: 2023-04-15 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=3 strategy("HODLBot", default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_every_tick=true, overlay=true) //// Time limits testStartYear = input(2017, "Backtest Start Year") testStartMonth = input(01, "Backtest Start Month") testStartDay = input(01, "Backtest Start Day") testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0) testStopYear = input(2029, "Backtest Stop Year") testStopMonth = input(1, "Backtest Stop Month") testStopDay = input(1, "Backtest Stop Day") testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0) testPeriod() => true maPeriod = input(200, "MA Period") smoothing = input(defval="EMA", options=["EMA", "SMA"]) ma(smoothing, src, length) => if smoothing == "EMA" ema(src, length) else if smoothing == "SMA" sma(src, length) //// Main //// movingAverage = ma(smoothing, close, maPeriod) plot(movingAverage, color=orange, style = line, linewidth = 4) // very simple, price over MA? Buy and HODL if (testPeriod() and close > movingAverage) strategy.entry("HODL", strategy.long) // Price under, close long if (testPeriod() and close < movingAverage) strategy.close("HODL")