
이는 2기간 이동평균(21과 55), RSI 모멘텀 지표, 거래량을 결합한 추세 추종 전략입니다. 이 전략은 가격, 모멘텀, 거래량의 세 가지 차원에서 시장 정보를 분석합니다. 추세 방향을 확인하는 동안 RSI와 거래량 지표를 통해 거래 신호를 필터링하여 거래 정확도를 개선합니다. 이 전략은 가격이 단기 이동 평균을 돌파하고 RSI가 이동 평균을 돌파할 때 거래량이 증가하여 추세의 타당성을 확인해야 합니다.
이 전략은 3중 필터링 메커니즘을 사용합니다.
구매 조건은 동시에 충족되어야 합니다:
판매 조건은 다음 중 하나일 수 있습니다.
이는 기술적 분석의 3가지 주요 요소(가격, 거래량, 모멘텀)를 활용하는 추세 추종 전략입니다. 이 전략은 다양한 필터링 메커니즘을 통해 신호의 신뢰성을 보장할 뿐만 아니라 특정 위험 제어 기능도 갖추고 있습니다. 몇 가지 본질적인 한계는 있지만, 지속적인 최적화와 개선을 통해 이 전략은 실제 거래에서 안정적인 수익을 달성할 것으로 기대됩니다. 특히 추세가 명확하고 유동성이 충분한 시장에서는 이 전략이 더 나은 성과를 거둘 수 있습니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("21/55 MA with RSI Crossover", overlay=true)
// Inputs for moving averages
ma21_length = input.int(21, title="21-day Moving Average Length", minval=1)
ma55_length = input.int(55, title="55-day Moving Average Length", minval=1)
// RSI settings
rsi_length = input.int(13, title="RSI Length", minval=1)
rsi_avg_length = input.int(13, title="RSI Average Length", minval=1)
// Moving averages
ma21 = ta.sma(close, ma21_length)
ma55 = ta.sma(close, ma55_length)
// Volume settings
vol_ma_length = input.int(21, title="Volume MA Length", minval=1)
// Volume moving average
vol_ma = ta.sma(volume, vol_ma_length)
// RSI calculation
rsi = ta.rsi(close, rsi_length)
rsi_avg = ta.sma(rsi, rsi_avg_length)
// Buy condition
// buy_condition = close > ma21 and ta.crossover(rsi, rsi_avg) and volume > vol_ma
buy_condition = close > ma21 and rsi > rsi_avg and volume > vol_ma
// Sell condition
// sell_condition = close < ma55 or ta.crossunder(rsi, rsi_avg)
sell_condition = ta.crossunder(close, ma55) or ta.crossunder(rsi, rsi_avg)
// Execute trades
if (buy_condition)
strategy.entry("Buy", strategy.long, comment="Buy Signal")
if (sell_condition)
strategy.close("Buy", comment="Sell Signal")
// Plot moving averages for reference
plot(ma21, color=color.blue, title="21-day MA")
plot(ma55, color=color.red, title="55-day MA")
// Plot RSI and RSI average for reference
rsi_plot = input.bool(true, title="Show RSI?", inline="rsi")
plot(rsi_plot ? rsi : na, color=color.green, title="RSI")
plot(rsi_plot ? rsi_avg : na, color=color.orange, title="RSI Average")