위험 관리 시스템과 결합된 다중 이동 평균 추세 모멘텀 거래 전략

EMA RSI ATR SMA STOCH
생성 날짜: 2024-12-05 14:52:06 마지막으로 수정됨: 2024-12-05 14:52:06
복사: 0 클릭수: 420
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

위험 관리 시스템과 결합된 다중 이동 평균 추세 모멘텀 거래 전략

개요

이는 동력과 추세를 결합한 거래 전략으로, 여러 지수 이동 평균 (EMA), 상대적으로 강한 지수 (RSI) 및 무작위 지수 (Stochastic) 를 통해 시장의 추세와 동력을 식별한다. 이 전략은 또한 동적 중지, 수익 목표 및 추적 중지 기능을 포함하는 평균 실제 파동 (ATR) 에 기반한 위험 관리 시스템을 통합하고 있으며, 위험 기반의 위치 관리 방법을 사용합니다.

전략 원칙

전략은 5개의 다른 주기적인 EMA를 사용하여 트렌드 방향을 결정한다. 더 짧은 기간의 EMA가 더 긴 기간의 EMA 위에 있을 때, 상승 추세로 인식된다. 반대로 하향 추세이다. RSI는 동력을 확인하기 위해 사용되며, 다른 입출입 및 출출입 마이너스를 설정한다.

전략적 이점

  1. 다중 확인 메커니즘: 트렌드 및 동력 지표와 결합하여 잘못된 신호의 위험을 줄입니다.
  2. 동적 위험 관리: 시장의 변동성에 따라 조정된 스톱로스 및 수익 목표
  3. 스마트 포지션 관리: 위험과 변동성에 따라 거래 규모를 자동으로 조정합니다.
  4. 전체 수익 보호: 추적 스톱 로킹을 사용하여 이미 수익을 창출합니다.
  5. 유연한 탈퇴 메커니즘: 여러 조건의 조합으로 적시에 탈퇴할 수 있다
  6. 낮은 위험 노출: 거래 당 최대 1%의 손실

전략적 위험

  1. 불안한 시장 위험: 다중평균형 시스템은 수평 시장에서 빈번한 잘못된 신호를 일으킬 수 있습니다.
  2. 슬라이드 포인트 위험: 높은 변동성 기간은 실제 실행 가격의 예상에서 벗어날 수 있습니다.
  3. 자금 관리 위험: 단편적 손실을 제한하지만 연속적인 손실은 여전히 자금에 큰 영향을 미칠 수 있습니다.
  4. 매개 변수 최적화 위험: 과도한 최적화가 과부응으로 이어질 수 있다
  5. 기술 지표 지연성: 평균선과 진동기는 어느 정도 지연성을 가지고 있다.

전략 최적화 방향

  1. 시장 환경 필터: 변동률 필터를 추가하여 높은 변동성 동안 전략 매개 변수를 조정합니다.
  2. 시간 필터: 다른 시기의 시장 특성에 따라 거래 매개 변수를 조정
  3. 동적 변수 조정: 시장 상황에 따라 EMA 주기와 지표 하락을 자동으로 조정
  4. 트래지먼트 확인이 증가: 트래지먼트 분석을 추가하여 신호 신뢰성을 높인다.
  5. 탈퇴 메커니즘을 최적화: 더 나은 추적 스톱 로즈 배수를 연구
  6. 머신러닝을 도입: 머신러닝을 이용한 최적화 매개 변수 선택

요약하다

이 전략은 다중 기술 지표와 완벽한 위험 관리 시스템을 결합하여 포괄적 인 거래 솔루션을 제공합니다. 그것의 핵심 장점은 다층의 필터링 메커니즘과 동적 위험 관리이지만 특정 시장 특성에 따라 여전히 최적화가 필요합니다. 전략의 성공적인 실행은 지속적인 모니터링과 조정, 특히 다른 시장 환경에서 변수의 적응력이 필요합니다. 제안된 최적화 방향으로 전략은 안정성과 수익성을 더욱 향상시킬 잠재력이 있습니다.

전략 소스 코드
/*backtest
start: 2024-11-04 00:00:00
end: 2024-12-04 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Combined Strategy (Modernized)", overlay = true)

//----------//
// MOMENTUM //
//----------//
ema8 = ta.ema(close, 8)
ema13 = ta.ema(close, 13)
ema21 = ta.ema(close, 21)
ema34 = ta.ema(close, 34)
ema55 = ta.ema(close, 55)

// Plotting EMAs for visualization
plot(ema8, color=color.red, title="EMA 8", linewidth=1)
plot(ema13, color=color.orange, title="EMA 13", linewidth=1)
plot(ema21, color=color.yellow, title="EMA 21", linewidth=1)
plot(ema34, color=color.aqua, title="EMA 34", linewidth=1)
plot(ema55, color=color.lime, title="EMA 55", linewidth=1)

longEmaCondition = ema8 > ema13 and ema13 > ema21 and ema21 > ema34 and ema34 > ema55
exitLongEmaCondition = ema13 < ema55

shortEmaCondition = ema8 < ema13 and ema13 < ema21 and ema21 < ema34 and ema34 < ema55
exitShortEmaCondition = ema13 > ema55

// ----------  //
// OSCILLATORS //
// ----------- //
rsi = ta.rsi(close, 14)
longRsiCondition = rsi < 70 and rsi > 40
exitLongRsiCondition = rsi > 70

shortRsiCondition = rsi > 30 and rsi < 60
exitShortRsiCondition = rsi < 30

// Stochastic
k = ta.stoch(close, high, low, 14)
d = ta.sma(k, 3)

longStochasticCondition = k < 80
exitLongStochasticCondition = k > 95

shortStochasticCondition = k > 20
exitShortStochasticCondition = k < 5

//----------//
// STRATEGY //
//----------//

// ATR for dynamic stop loss and take profit
atr = ta.atr(14)
stopLossMultiplier = 2
takeProfitMultiplier = 4
stopLoss = atr * stopLossMultiplier
takeProfit = atr * takeProfitMultiplier

// Trailing stop settings
trailStopMultiplier = 1.5
trailOffset = atr * trailStopMultiplier

// Risk management: dynamic position sizing
riskPerTrade = 0.01  // 1% risk per trade
positionSize = strategy.equity * riskPerTrade / stopLoss

longCondition = longEmaCondition and longRsiCondition and longStochasticCondition and strategy.position_size == 0
exitLongCondition = (exitLongEmaCondition or exitLongRsiCondition or exitLongStochasticCondition) and strategy.position_size > 0

if (longCondition)
    strategy.entry("LONG", strategy.long, qty=positionSize)
    strategy.exit("Take Profit Long", "LONG", stop=close - stopLoss, limit=close + takeProfit, trail_offset=trailOffset)

if (exitLongCondition)
    strategy.close("LONG")
    
shortCondition = shortEmaCondition and shortRsiCondition and shortStochasticCondition and strategy.position_size == 0
exitShortCondition = (exitShortEmaCondition or exitShortRsiCondition or exitShortStochasticCondition) and strategy.position_size < 0

if (shortCondition)
    strategy.entry("SHORT", strategy.short, qty=positionSize)
    strategy.exit("Take Profit Short", "SHORT", stop=close + stopLoss, limit=close - takeProfit, trail_offset=trailOffset)

if (exitShortCondition)
    strategy.close("SHORT")