위험 관리 시스템과 결합된 동적 지표 기반 추세 추종 전략

EMA RSI DMI ATR MOM VOL
생성 날짜: 2025-02-10 14:20:44 마지막으로 수정됨: 2025-02-10 14:20:44
복사: 0 클릭수: 407
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

위험 관리 시스템과 결합된 동적 지표 기반 추세 추종 전략

개요

이것은 다중 기술 지표와 위험 관리에 기반한 트렌드 추적 전략이다. 이 전략은 이동 평균, 상대적으로 강한 지표 ((RSI), 운동 지표 ((DMI) 와 같은 여러 기술 지표를 통합적으로 사용하여 시장 추세를 식별하고, 동적 손실, 위치 관리 및 월 최대 인출 제한과 같은 위험 제어 수단으로 자금을 보호한다. 이 전략의 핵심은 다차원 기술 지표를 통해 트렌드의 유효성을 확인하는 것과 동시에 위험을 엄격히 통제하는 것이다.

전략 원칙

이 전략은 여러 계층의 트렌드 확인 메커니즘을 사용합니다.

  1. 8/21/50 주기 지수 이동 평균 (EMA) 을 통해 트렌드 방향을 판단
  2. 트렌드 필터로 가격 채널 중선을 사용함
  3. RSI 평균선 ((5주기) 과 결합하여 35-65 범위의 움직임을 필터링하여 가짜 브레이크를 처리합니다.
  4. DMI 지표 ((14주기) 를 통해 트렌드 강도를 확인
  5. 동력 지표 ((8주기) 와 교류량을 확대하여 트렌드의 지속성을 검증
  6. ATR 기반의 동적 상쇄를 사용하여 위험을 제어합니다.
  7. 고정 리스크 모드를 적용한 포지션 관리, 각 거래의 리스크 범위는 초기 자본의 5%
  8. 과도한 손실을 방지하기 위해 월 최대 인출 제한을 10%로 설정합니다.

전략적 이점

  1. 트렌드 판단의 정확성을 높이는 다중 기술 지표의 크로스 검증
  2. 다이내믹 스톱 메커니즘은 단일 거래 위험을 효과적으로 제어합니다.
  3. 고정된 리스크의 포지션 관리 방식은 자금을 보다 합리적으로 사용하도록 합니다.
  4. 월 최대 인출 제한은 체계적인 위험 방어를 제공합니다.
  5. 트렌드 확인의 신뢰성을 강화하기 위한 합성 거래량 지표
  6. 2:1의 이익/손실 비율이 장기적인 수익성을 높여줍니다.

전략적 위험

  1. 다중 지표의 사용은 신호 지연을 초래할 수 있습니다.
  2. 불안한 시장에서 빈번한 잘못된 신호가 발생할 수 있습니다.
  3. 고정 위험 모형은 급격한 변동에 대해 유연하지 않을 수 있습니다.
  4. 월간 인출 제한으로 인해 중요한 거래 기회를 놓칠 수 있습니다.
  5. 트렌드가 반전될 경우 더 큰 반전을 겪을 수 있다.

전략 최적화 방향

  1. 다양한 시장 환경에 맞게 적응 가능한 지표 매개 변수를 도입합니다.
  2. 시장의 변동성을 고려하여 더 유연한 포지션 관리 프로그램을 개발
  3. 트렌드 강도를 평가하고, 진입 시기를 최적화합니다.
  4. 더 똑똑한 월간 리스크 제한 장치를 설계합니다.
  5. 시장 환경 인식 모듈을 추가하여 다른 시장 조건에 따라 전략 매개 변수를 조정합니다.

요약하다

이 전략은 다차원 기술 지표의 통합적인 사용을 통해 비교적 완전한 트렌드 추적 거래 시스템을 구축한다. 전략의 장점은 역동적 인 손실, 위치 관리 및 철회 제어를 포함한 포괄적 인 위험 관리 프레임 워크에 있다. 약간의 뒤처짐 위험이 있지만, 최적화 및 개선으로 전략은 다양한 시장 환경에서 안정적인 성능을 유지할 것으로 예상된다. 핵심은 전략의 핵심 논리를 유지하면서 시장 환경에 대한 적응력을 강화하는 것입니다.

전략 소스 코드
/*backtest
start: 2024-02-10 00:00:00
end: 2025-02-08 08:00:00
period: 4h
basePeriod: 4h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("High Win-Rate Crypto Strategy with Drawdown Limit", overlay=true, initial_capital=10000, default_qty_type=strategy.fixed, process_orders_on_close=true)

// Moving Averages
ema8 = ta.ema(close, 8)
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)

// RSI settings
rsi = ta.rsi(close, 14)
rsi_ma = ta.sma(rsi, 5)

// Momentum and Volume
mom = ta.mom(close, 8)
vol_ma = ta.sma(volume, 15)
high_vol = volume > vol_ma * 1

// Trend Strength
[diplus, diminus, _] = ta.dmi(14, 14)
strong_trend = diplus > 20 or diminus > 20

// Price channels
highest_15 = ta.highest(high, 15)
lowest_15 = ta.lowest(low, 15)
mid_channel = (highest_15 + lowest_15) / 2

// Trend Conditions
uptrend = ema8 > ema21 and close > mid_channel
downtrend = ema8 < ema21 and close < mid_channel

// Entry Conditions
longCondition = uptrend and ta.crossover(ema8, ema21) and rsi_ma > 35 and rsi_ma < 65 and mom > 0 and high_vol and diplus > diminus
shortCondition = downtrend and ta.crossunder(ema8, ema21) and rsi_ma > 35 and rsi_ma < 65 and mom < 0 and high_vol and diminus > diplus

// Dynamic Stop Loss based on ATR
atr = ta.atr(14)
stopSize = atr * 1.3

// Calculate position size based on fixed risk
riskAmount = strategy.initial_capital * 0.05

getLongPosSize(riskAmount, stopSize) => riskAmount / stopSize    
getShortPosSize(riskAmount, stopSize) => riskAmount / stopSize

// Monthly drawdown tracking
var float peakEquity = na
var int currentMonth = na
var float monthlyDrawdown = na
maxDrawdownPercent = 10

// Variables for SL and TP
var float stopLoss = na
var float takeProfit = na
var bool inTrade = false
var string tradeType = na

// Reset monthly metrics
monthNow = month(time)
if na(currentMonth) or currentMonth != monthNow
    currentMonth := monthNow
    peakEquity := strategy.equity
    monthlyDrawdown := 0.0

// Update drawdown metrics
peakEquity := math.max(peakEquity, strategy.equity)
monthlyDrawdown := math.max(monthlyDrawdown, (peakEquity - strategy.equity) / peakEquity * 100)

// Trading condition
canTrade = monthlyDrawdown < maxDrawdownPercent

// Entry and Exit Logic
if strategy.position_size == 0
    inTrade := false
    if longCondition and canTrade
        stopLoss := low - stopSize
        takeProfit := close + (stopSize * 2)
        posSize = getLongPosSize(riskAmount, stopSize)
        strategy.entry("Long", strategy.long, qty=posSize)
        strategy.exit("Long Exit", "Long", stop=stopLoss, limit=takeProfit)
        inTrade := true
        tradeType := "long"
    if shortCondition and canTrade
        stopLoss := high + stopSize
        takeProfit := close - (stopSize * 2)
        posSize = getShortPosSize(riskAmount, stopSize)
        strategy.entry("Short", strategy.short, qty=posSize)
        strategy.exit("Short Exit", "Short", stop=stopLoss, limit=takeProfit)
        inTrade := true
        tradeType := "short"

// Plot variables
plotSL = inTrade ? stopLoss : na
plotTP = inTrade ? takeProfit : na

// EMA Plots
plot(ema8, "EMA 8", color=color.blue, linewidth=1)
plot(ema21, "EMA 21", color=color.yellow, linewidth=1)
plot(ema50, "EMA 50", color=color.white, linewidth=1)

// SL and TP Plots
plot(plotSL, "Stop Loss", color=color.red, style=plot.style_linebr, linewidth=1)
plot(plotTP, "Take Profit", color=color.green, style=plot.style_linebr, linewidth=1)

// Signal Plots
plotshape(longCondition and canTrade, "Buy Signal", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small)
plotshape(shortCondition and canTrade, "Sell Signal", style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small)

// SL/TP Markers with correct y parameter syntax
plot(inTrade ? stopLoss : na, "Stop Loss Level", style=plot.style_circles, color=color.red, linewidth=2)
plot(inTrade ? takeProfit : na, "Take Profit Level", style=plot.style_circles, color=color.green, linewidth=2)

// Background Color
noTradingMonth = monthlyDrawdown >= maxDrawdownPercent
bgcolor(noTradingMonth ? color.new(color.gray, 80) : uptrend ? color.new(color.green, 95) : downtrend ? color.new(color.red, 95) : na)

// Drawdown Label
var label drawdownLabel = na
label.delete(drawdownLabel)
drawdownLabel := label.new(bar_index, high, "Monthly Drawdown: " + str.tostring(monthlyDrawdown, "#.##") + "%\n" + (noTradingMonth ? "NO TRADING" : "TRADING ALLOWED"), style=label.style_label_down, color=noTradingMonth ? color.red : color.green, textcolor=color.white, size=size.small)