다중 평활 이동 평균 동적 교차 추세 추적 및 다중 확인 양적 거래 전략

MA EMA RSI ATR SMA RMA WMA SL TP
생성 날짜: 2025-01-17 15:53:16 마지막으로 수정됨: 2025-01-17 15:53:16
복사: 2 클릭수: 388
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

다중 평활 이동 평균 동적 교차 추세 추적 및 다중 확인 양적 거래 전략

개요

이 전략은 다중 평활화 이동 평균을 기반으로 하는 추세 추종 시스템으로, RSI 모멘텀 지표, ATR 변동성 지표 및 200기간 EMA 추세 필터를 결합하는 동시에 삼중 평활화를 사용하여 시장 노이즈를 필터링하여 거래 신호를 확인합니다. 이 전략은 1시간 기간을 사용하는데, 이는 거래 빈도와 추세 신뢰성의 균형을 효과적으로 맞추면서 기관 거래 행동과 일치하는 기간입니다.

전략 원칙

전략의 핵심은 가격을 세 번 평활화하여 주요 추세선을 구성하고, 짧은 기간의 신호선을 사용해 이를 교차하여 거래 신호를 생성하는 것입니다. 거래 신호는 다음 조건이 동시에 충족되는 경우에만 실행됩니다.

  1. 가격 위치와 200EMA 간의 관계는 주요 추세 방향을 확인합니다.
  2. RSI 지표 위치가 모멘텀을 확인
  3. ATR 지표는 충분한 변동성을 확인합니다.
  4. 신호선과 삼중 평활 이동평균선의 교차는 특정 진입점을 확인합니다. 손절매는 ATR에 기반한 동적 손절매를 채택하고, 이익실현은 ATR의 2배로 설정되어 양호한 위험-수익 비율을 보장합니다.

전략적 이점

  1. 트리플 스무딩은 거짓 신호를 크게 줄이고 추세 판단의 신뢰성을 향상시킵니다.
  2. 다중 확인 메커니즘을 통해 거래 방향이 주요 추세와 일치하도록 보장합니다.
  3. 다양한 시장 변동에 적응하기 위한 동적 손절매 및 이익 실현 설정
  4. 이 전략은 1시간 주기로 실행되므로 낮은 시간 주기에서는 충격을 효과적으로 피할 수 있습니다.
  5. 다시 그리기 금지 기능은 백테스팅 결과의 신뢰성을 보장합니다.

전략적 위험

  1. 횡보장세에서는 지속적으로 소액손실이 발생할 수 있습니다.
  2. 여러 확인 메커니즘으로 인해 거래 기회를 놓칠 수 있습니다.
  3. 신호 지연은 진입점 최적화에 영향을 미칠 수 있습니다.
  4. 유효한 신호를 생성하려면 충분한 변동성이 필요합니다.
  5. 극단적인 시장 상황에서는 동적 손절매가 시기적으로 적절하지 않을 수 있습니다.

전략 최적화 방향

  1. 보조 확인으로 볼륨 표시기를 추가할 수 있습니다.
  2. 적응형 매개변수 최적화 메커니즘 도입을 고려하세요
  3. 트렌드 강도에 대한 정량적 판단을 증가시킬 수 있습니다.
  4. 손절매와 이익실현의 다중 설정 최적화
  5. 측면 시장 성과를 최적화하기 위해 오실레이터를 추가하는 것을 고려하세요

요약하다

이는 완전한 구조와 엄격한 논리를 갖춘 추세 추종 전략입니다. 여러 차례의 평활화 과정과 여러 가지 확인 메커니즘을 통해 거래 신호의 신뢰성이 효과적으로 향상됩니다. 역동적인 위험 관리 메커니즘은 매우 적응력이 뛰어납니다. 어느 정도 지연은 있지만, 매개변수 최적화와 보조 지표 추가를 통해 전략을 개선할 여지가 많이 있습니다.

전략 소스 코드
/*backtest
start: 2024-12-17 00:00:00
end: 2025-01-16 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":49999}]
*/

//@version=6
strategy("Optimized Triple Smoothed MA Crossover Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=200)

// === Input Settings ===
slength = input.int(7, "Main Smoothing Length", group="Moving Average Settings")
siglen = input.int(12, "Signal Length", group="Moving Average Settings")
src = input.source(close, "Data Source", group="Moving Average Settings")
mat = input.string("EMA", "Triple Smoothed MA Type", ["EMA", "SMA", "RMA", "WMA"], group="Moving Average Settings")
mat1 = input.string("EMA", "Signal Type", ["EMA", "SMA", "RMA", "WMA"], group="Moving Average Settings")

// === Trend Confirmation (Higher Timeframe Filter) ===
useTrendFilter = input.bool(true, "Enable Trend Filter (200 EMA)", group="Trend Confirmation")
trendMA = ta.ema(close, 200)

// === Momentum Filter (RSI Confirmation) ===
useRSIFilter = input.bool(true, "Enable RSI Confirmation", group="Momentum Confirmation")
rsi = ta.rsi(close, 14)
rsiThreshold = input.int(50, "RSI Threshold", group="Momentum Confirmation")

// === Volatility Filter (ATR) ===
useATRFilter = input.bool(true, "Enable ATR Filter", group="Volatility Filtering")
atr = ta.atr(14)
atrMa = ta.sma(atr, 14)

// === Risk Management (ATR-Based Stop Loss) ===
useAdaptiveSL = input.bool(true, "Use ATR-Based Stop Loss", group="Risk Management")
atrMultiplier = input.float(1.5, "ATR Multiplier for SL", minval=0.5, maxval=5, group="Risk Management")
takeProfitMultiplier = input.float(2, "Take Profit Multiplier", group="Risk Management")

// === Moving Average Function ===
ma(source, length, MAtype) =>
    switch MAtype
        "SMA" => ta.sma(source, length)
        "EMA" => ta.ema(source, length)
        "RMA" => ta.rma(source, length)
        "WMA" => ta.wma(source, length)

// === Triple Smoothed Calculation ===
tripleSmoothedMA = ma(ma(ma(src, slength, mat), slength, mat), slength, mat)
signalLine = ma(tripleSmoothedMA, siglen, mat1)

// === Crossovers (Entry Signals) ===
bullishCrossover = ta.crossunder(signalLine, tripleSmoothedMA)
bearishCrossover = ta.crossover(signalLine, tripleSmoothedMA)

// === Additional Confirmation Conditions ===
trendLongCondition = not useTrendFilter or (close > trendMA)  // Only long if price is above 200 EMA
trendShortCondition = not useTrendFilter or (close < trendMA) // Only short if price is below 200 EMA

rsiLongCondition = not useRSIFilter or (rsi > rsiThreshold)  // RSI above 50 for longs
rsiShortCondition = not useRSIFilter or (rsi < rsiThreshold) // RSI below 50 for shorts

atrCondition = not useATRFilter or (atr > atrMa)  // ATR must be above its MA for volatility confirmation

// === Final Trade Entry Conditions ===
longCondition = bullishCrossover and trendLongCondition and rsiLongCondition and atrCondition
shortCondition = bearishCrossover and trendShortCondition and rsiShortCondition and atrCondition

// === ATR-Based Stop Loss & Take Profit ===
longSL = close - (atr * atrMultiplier)
longTP = close + (atr * takeProfitMultiplier)

shortSL = close + (atr * atrMultiplier)
shortTP = close - (atr * takeProfitMultiplier)

// === Strategy Execution ===
if longCondition
    strategy.entry("Long", strategy.long)
    strategy.exit("Long Exit", from_entry="Long", stop=longSL, limit=longTP)

if shortCondition
    strategy.entry("Short", strategy.short)
    strategy.exit("Short Exit", from_entry="Short", stop=shortSL, limit=shortTP)

// === Plots ===
plot(tripleSmoothedMA, title="Triple Smoothed MA", color=color.blue)
plot(signalLine, title="Signal Line", color=color.red)
plot(trendMA, title="200 EMA", color=color.gray)

// === Alerts ===
alertcondition(longCondition, title="Bullish Signal", message="Triple Smoothed MA Bullish Crossover Confirmed")
alertcondition(shortCondition, title="Bearish Signal", message="Triple Smoothed MA Bearish Crossover Confirmed")