
다중평균선 회귀 MACD 트렌드 확인 전략은 평평선 시스템, 가격 회귀 및 MACD 지표를 결합한 트렌드 거래 시스템이다. 이 전략의 핵심은 가격 회귀가 장기평균선 ((200/250평균선) 에 가까운 거래 기회를 찾는 것이며 MACD 지표를 입점 확인 신호로 사용하는 것이다. 전략은 동시에 다중 숨겨진 평평선을 보조 필터링 조건으로 사용하며, ATR 기반의 동적 중지 손실 및 고정 위험 수익률을 설정하여 전체 거래 시스템을 형성한다.
이 전략은 다음과 같은 핵심 원칙에 기초하여 거래됩니다.
입학 조건:
공허 입학 조건:
다중 평균선 회귀 MACD 트렌드 확인 전략은 여러 가지 기술적 분석 방법을 통합한 통합 거래 시스템이며, 핵심 장점은 트렌드 판단, 가격 회귀 이론, 동력 확인 및 체계화된 위험 관리의 결합에 있다. 전략은 평균선 시스템을 통해 전체적인 트렌드 방향을 식별하고, 가격 회귀를 통해 장기 평균선 근처의 메커니즘을 통해 높은 승률 입구를 찾으며, MACD를 동력 확인 신호로 사용하여 가짜 신호를 줄인다.
이 전략은 중장기 트렌드 시장에 특히 적합하며, 강한 트렌드 환경에서 가격 회정을 캡처하고 추세 방향으로 계속 발전 할 수있는 기회를 제공합니다. 그러나, 전략에는 평평선 낙후, 거래 기회 희소성 등의 잠재적인 위험이 있으며, 시장 환경 필터링, 동적 위험 관리 등의 방법으로 최적화가 필요합니다.
시장 환경 필터링 메커니즘을 추가하고, 리스크 수익률을 동적으로 조정하고, 일률 시스템을 개선함으로써, 이 전략은 더욱 안정적이고 적응력을 향상시키고, 더 포괄적이고 효과적인 거래 시스템으로 발전할 전망이다. 체계화된 거래를 추구하는 투자자에게, 이 전략은 여러 기술 지표와 완전한 위험 관리 메커니즘을 갖춘 거래 프레임워크를 고려할 가치가 있다.
/*backtest
start: 2025-01-01 00:00:00
end: 2025-03-27 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=5
strategy("Price Near 200 EMA", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// === User Inputs ===
ema1Length = input(20, title="EMA 1 Length") // Main EMA (Trend)
ema2Length = input(250, title="EMA 2 Length") // Long-term EMA
macdFastLength = input(12, title="MACD Fast Length")
macdSlowLength = input(26, title="MACD Slow Length")
macdSignalLength = input(9, title="MACD Signal Length")
rrRatio = input.float(1.5, title="Risk to Reward Ratio", minval=1, step=0.1)
atrMultiplier = input.float(5, title="ATR Multiplier for SL", minval=1, step=0.1) // Default to 5x ATR
atrLength = input(14, title="ATR Length") // User-defined ATR length
// === Hidden EMA Lengths (Hardcoded) ===
ema3Length = 2 // Fast EMA (Hidden)
ema4Length = 100 // Medium EMA (Hidden)
ema5Length = 300 // Long EMA (Hidden)
// === EMA Calculations ===
ema1 = ta.ema(close, ema1Length) // 20 EMA
ema2 = ta.ema(close, ema2Length) // 250 EMA
ema3 = ta.ema(close, ema3Length) // 2 EMA (Hidden)
ema4 = ta.ema(close, ema4Length) // 100 EMA (Hidden)
ema5 = ta.ema(close, ema5Length) // 300 EMA (Hidden)
// === MACD Calculation ===
[macdLine, signalLine, _] = ta.macd(close, macdFastLength, macdSlowLength, macdSignalLength)
macdBullish = ta.crossover(macdLine, signalLine)
macdBearish = ta.crossunder(macdLine, signalLine)
// === ATR for Dynamic Stop Loss ===
atrValue = ta.atr(atrLength)
// === Long Conditions ===
bullishCondition1 = ema1 > ema2
bullishCondition2 = ema3 > ema5 and ema3 < ema4
bullishEntry = bullishCondition1 and bullishCondition2 and macdBullish
// === Short Conditions ===
bearishCondition1 = ema1 < ema2
bearishCondition2 = ema3 < ema5 and ema3 > ema4
bearishEntry = bearishCondition1 and bearishCondition2 and macdBearish
// === Calculate Stop Loss and Target Using ATR ===
longStopLoss = close - atrValue * atrMultiplier
longTargetPrice = close + (close - longStopLoss) * rrRatio
shortStopLoss = close + atrValue * atrMultiplier
shortTargetPrice = close - (shortStopLoss - close) * rrRatio
// === Entry and Exit Logic ===
if bullishEntry
strategy.entry("Buy", strategy.long)
strategy.exit("TP Long", "Buy", limit=longTargetPrice, stop=longStopLoss, comment="SL/TP Long")
if bearishEntry
strategy.entry("Sell", strategy.short)
strategy.exit("TP Short", "Sell", limit=shortTargetPrice, stop=shortStopLoss, comment="SL/TP Short")
// === Plotting Only Visible EMAs ===
plot(ema1, title="EMA 1", color=color.blue)
plot(ema2, title="EMA 2", color=color.red)
// === Background Highlight for Entries ===
bgcolor(bullishEntry ? color.new(color.green, 90) : na, title="Bullish Background")
bgcolor(bearishEntry ? color.new(color.red, 90) : na, title="Bearish Background")