다중 기술 지표 동적 적응형 거래 전략(MTDAT)

MACD RSI BB ATR SMA SD
생성 날짜: 2024-11-29 14:54:57 마지막으로 수정됨: 2024-11-29 14:54:57
복사: 0 클릭수: 506
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

다중 기술 지표 동적 적응형 거래 전략(MTDAT)

개요

이 전략은 다중 기술 지표를 기반으로 한 통합 거래 시스템으로, MACD, RSI, 브린 띠 및 ATR과 같은 여러 기술 지표를 결합하여 시장 추세와 역전 기회를 포착합니다. 전략은 동적인 중지 및 수익 계획을 채택하여 시장의 변동성에 따라 거래 매개 변수를 조정하여 수익을 보장하면서 위험을 효과적으로 제어합니다. 재검토 결과, 이 전략은 지난 3 개월 동안 테스트 기간 동안 676.27%의 수익률을 달성했으며, 시장 적응성을 잘 보여줍니다.

전략 원칙

이 전략은 다음과 같은 다층적인 기술 지표 검증 시스템을 적용합니다.

  1. MACD ((12,26,9) 는 운동량 변환 신호를 잡기 위해 사용되며, MACD 라인을 상단으로 통과할 때 구매 신호를 생성하고, 하단으로 통과할 때 판매 신호를 생성한다.
  2. RSI ((14) 는 2차 필터로, 35 이하는 과매도 지역으로, 65 이상은 과매도 지역으로 간주됩니다.
  3. 브린 띠 ((20,2) 가격 변동 영역을 식별하기 위해 사용되며, 가격이 하위 궤도를 건드렸을 때 구매를 고려하고 상위 궤도를 건드렸을 때 판매를 고려합니다.
  4. ATR은 3배 ATR으로 설정된 스톱로즈와 5배 ATR으로 설정된 수익 목표를 동적으로 설정하는 데 사용됩니다.

거래 논리는 트렌드 추적과 역전 거래의 두 가지 전략을 결합하여 여러 가지 검증을 통해 거래의 정확성을 향상시킵니다. 시스템은 시장의 실시간 변동성에 따라 자동으로 중지 손실과 수익 수준을 조정하여 위험 관리의 동적 최적화를 구현합니다.

전략적 이점

  1. 다차원 신호 검증 시스템은 거래의 신뢰성을 향상시킵니다.
  2. 동적 상쇄 수익 계획은 다양한 시장 환경에 적응합니다.
  3. 트렌드와 역전 두 가지의 트레이딩 사고를 통합하여 트레이딩 기회를 증가시킵니다.
  4. 자동화된 위험 관리 시스템으로 인적 판단 오류가 줄어든다
  5. 53.99%의 승률과 1.44의 수익률은 전략이 안정적이라는 것을 보여줍니다.
  6. 실시간 트레이드 리모델링을 지원하는 전략

전략적 위험

  1. 다중 지표로 인해 신호가 지연되고, 빠른 시장에서 기회를 놓치게 될 수 있습니다.
  2. 56.33%의 최대 회수율은 더 큰 위험성을 요구합니다.
  3. 거래 빈도가 높은 거래 비용
  4. 전략은 급격한 변동 시장에서 더 큰 위험에 직면할 수 있습니다.

위험 관리 제안:

  • 돈 관리 계획을 엄격하게 실행하세요.
  • 매개 변수를 주기적으로 확인하고 조정합니다.
  • 중요한 자료가 공개되는 동안 거래 중지
  • 하루 최대 손실을 설정합니다.

전략 최적화 방향

  1. 변수 최적화:

    • 적응주기를 사용하는 지표 변수를 고려합니다.
    • ATR 배수 설정을 최적화하여 리스크/이익 비율을 높여라
  2. 신호 시스템 개선:

    • 트랜스포메이션을 추가합니다.
    • 시장 감정 지표를 도입합니다.
  3. 위험 관리 최적화:

    • 동적 위치관리 실현
    • 시간 필터를 추가
  4. 기술 개선:

    • 시장 변동율 필터를 추가합니다.
    • 출전 타이밍 판단을 최적화

요약하다

이 전략은 다중 기술 지표의 조합과 동적 위험 관리 시스템을 통해 더 나은 거래 효과를 달성한다. 약간의 회수 위험이 존재하지만, 엄격한 위험 제어 및 지속적인 최적화를 통해 전략은 좋은 시장 적응성과 안정성을 보여준다. 이 전략을 사용할 때 거래자는 위험 관리 시스템을 엄격하게 시행하고 시장 변화에 따라 매개 변수를 조정하는 것이 좋습니다.

전략 소스 코드
/*backtest
start: 2024-11-21 00:00:00
end: 2024-11-28 00:00:00
period: 15m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("XAUUSD STRATEGY 10MIN", overlay=true)

// Spread Adjustment (38-point spread)
spread = 38 * syminfo.mintick       

// MACD Calculation
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)
macdBuy = ta.crossover(macdLine, signalLine)
macdSell = ta.crossunder(macdLine, signalLine)

// RSI Calculation
rsi = ta.rsi(close, 14)
rsiOverbought = rsi > 65
rsiOversold = rsi < 35

// Bollinger Bands Calculation
basis = ta.sma(close, 20)
dev = 2 * ta.stdev(close, 20)
upperBand = basis + dev
lowerBand = basis - dev

// ATR Calculation for Volatility-Based Stop Loss and Take Profit
atr = ta.atr(14)
stopLoss = 3 * atr
takeProfit = 5 * atr

// Variables to track entry price and line
var line entryLine = na
var int tradeNumber = 0
var string tradeType = ""
var string tradeSignalComment = ""

// Buy Condition
buyCondition = (macdBuy or rsiOversold or close < lowerBand)

// Sell Condition
sellCondition = (macdSell or rsiOverbought or close > upperBand)

// Strategy Entry and Alerts
if (buyCondition and strategy.opentrades == 0)  // Open a new buy trade
    // Remove the previous entry line if it exists
    // if not na(entryLine)
    //     line.delete(entryLine)
    
    // Adjust the entry price by adding the spread (ask price)
    buyPrice = close + spread

    // Enter a new buy trade at the ask price, and close it with the bid price
    strategy.entry("Buy", strategy.long, stop=buyPrice - stopLoss, limit=buyPrice + takeProfit, comment="Enter buy $" + str.tostring(buyPrice))
    tradeNumber := tradeNumber + 1  // Increment trade number
    tradeType := "Entry Long"
    tradeSignalComment := "Enter buy trade"
    
    // Plot new dotted entry line for the current trade
    // entryLine := line.new(bar_index, buyPrice, bar_index + 50, buyPrice, width=1, color=color.green, style=line.style_dotted)
    
    // Send alert for the buy entry
    alert("Trade No: " + str.tostring(tradeNumber) + "\n" +
          "Signal: " + tradeType + " - " + tradeSignalComment + "\n" +
          "Date/Time: " + str.format("{0,date,dd-MM-yyyy HH:mm}", time) + "\n" +
          "Price: " + str.tostring(buyPrice), alert.freq_once_per_bar_close)

if (sellCondition and strategy.opentrades == 0)  // Open a new sell trade
    // Remove the previous entry line if it exists
    // if not na(entryLine)
    //     line.delete(entryLine)
    
    // Adjust the entry price by subtracting the spread (bid price)
    sellPrice = close - spread

    // Enter a new sell trade at the bid price, and close it with the ask price
    strategy.entry("Sell", strategy.short, stop=sellPrice + stopLoss, limit=sellPrice - takeProfit, comment="Enter sell $" + str.tostring(sellPrice))
    tradeNumber := tradeNumber + 1  // Increment trade number
    tradeType := "Entry Short"
    tradeSignalComment := "Enter sell trade"
    
    // Plot new dotted entry line for the current trade
    // entryLine := line.new(bar_index, sellPrice, bar_index + 50, sellPrice, width=1, color=color.red, style=line.style_dotted)
    
    // Send alert for the sell entry
    alert("Trade No: " + str.tostring(tradeNumber) + "\n" +
          "Signal: " + tradeType + " - " + tradeSignalComment + "\n" +
          "Date/Time: " + str.format("{0,date,dd-MM-yyyy HH:mm}", time) + "\n" +
          "Price: " + str.tostring(sellPrice), alert.freq_once_per_bar_close)

// Exit conditions and alerts
if (strategy.position_size > 0 and sellCondition)  // Close buy when sell conditions met
    // Adjust the exit price by subtracting the spread (bid price)
    exitPrice = close - spread
    strategy.close("Buy", comment="Exit buy $" + str.tostring(exitPrice))
    
    // Remove the entry line when the trade is closed
    // if not na(entryLine)
    //     line.delete(entryLine)
    
    // Send alert for the buy exit
    tradeType := "Exit Long"
    tradeSignalComment := "Exit buy trade"
    alert("Trade No: " + str.tostring(tradeNumber) + "\n" +
          "Signal: " + tradeType + " - "  + tradeSignalComment + "\n" +
          "Date/Time: " + str.format("{0,date,dd-MM-yyyy HH:mm}", time) + "\n" +
          "Price: " + str.tostring(exitPrice), alert.freq_once_per_bar_close)

if (strategy.position_size < 0 and buyCondition)  // Close sell when buy conditions met
    // Adjust the exit price by adding the spread (ask price)
    exitPrice = close + spread
    strategy.close("Sell", comment="Exit sell $" + str.tostring(exitPrice))
    
    // Remove the entry line when the trade is closed
    // if not na(entryLine)
    //     line.delete(entryLine)
    
    // Send alert for the sell exit
    tradeType := "Exit Short"
    tradeSignalComment := "Exit sell trade"
    alert("Trade No: " + str.tostring(tradeNumber) + "\n" +
          "Signal: " + tradeType + " - " + tradeSignalComment + "\n" +
          "Date/Time: " + str.format("{0,date,dd-MM-yyyy HH:mm}", time) + "\n" +
          "Price: " + str.tostring(exitPrice), alert.freq_once_per_bar_close)

// Plot Indicators
plot(upperBand, title="Upper Bollinger Band", color=color.blue)
plot(lowerBand, title="Lower Bollinger Band", color=color.blue)