
이 전략의 핵심 논리는 간단하고 거칠다: Zero Lag EMA는 전통적인 이동 평균의 지연성을 제거하고, SuperTrend은 트렌드 방향을 확인한다. 두 지표가 동시에 상향 또는 하향으로 이동해야 함으로써, 이중 필터링 메커니즘은 반감에서 가짜 돌파의 영향을 크게 감소시킵니다. 70 주기의 Zero Lag 설정은 1.2 배의 변동률 배수와 함께 시장 소음을 효과적으로 필터링하여 진정한 트렌드 전환점만을 포착합니다.
중요한 것은 변동성을 계산하는 것입니다.*3) * mult, 이 공식은 210주기에 걸친 최고 ATR값을 1.2로 곱하여, 충분히 큰 변동률의 임계값을 깨는 것만이 신호를 유발할 수 있도록 한다. 실험적 자료에 따르면, 이것은 단순히 고정된 임계값을 사용하는 전략보다 약 40%의 무효 거래가 줄어들었다.
슈퍼트렌드 부분은 14주기 ATR을 사용하여 3.0배배 배수와 협력하며, 이 파라미터 조합은 대부분의 시장 환경에서 안정적으로 작동한다. 시장에서 흔히 볼 수 있는 2.0배에서 2.5배의 설정에 비해, 3.0배 배수는 일부 단기 반등 기회를 놓칠 수 있지만, 충격적인 상황에서 빈번한 중지 손실을 크게 줄일 수 있다.
스톱 스톱 손실 설정은 고정 비율: 1.0% 스톱 스톱, 0.5% 스톱 스톱, 위험 수익 비율이 2:1에 달한다. 이 설정은 고주파 거래 환경에 적합하지만, 낮은 변동률 시장에서 스톱 스톱이 너무 민감하게 발생할 수 있는 문제에 주의를 기울여야 한다.
특히 주목할 만한 것은 출구 경보의 설계입니다: longTP_hit 및 longSL_hit는 strategy.position_size를 통해 포지션 상태를 판단하여 반복 신호의 간섭을 피합니다. 이러한 설계는 실디 거래에서 매우 중요하며, 네트워크 지연으로 인한 반복적인 포지션 청산을 방지합니다.
트렌드 시장:length는 50로 조정할 수 있고,mult는 1.0로 줄이고, 신호 민감도를 높일 수 있다. 시장의 흔들림: length가 90으로 증가, Factor가 3.5로 증가, 가짜 돌파구가 감소 높은 변동성 환경스톱 손실이 1.0%로 확대되고, 스톱 조정이 2.0%로 확대되어, 더 큰 가격 변동에 적응합니다.
Zero Lag EMA의 레이그 계산 공식math.floor (((length - 1) / 2) 은 지표의 응답 속도를 보장하지만, 극단적인 상황에서는 여전히 지연이 발생할 수 있습니다. 합성 거래량 지표가 2차 확인을 위해 권장되며, 거래량이 20주기 평균보다 낮을 때 거래 신호를 일시 중지합니다.
역사적인 재검토 데이터에 따르면, 이 전략은 추세가 뚜렷한 시장 환경에서 잘 작동하지만, 수평 정리 단계에서 연속적으로 작은 손실을 초래할 수 있습니다. 위험 조정된 수익률은 대부분의 테스트 기간 동안 기준 지수보다 우수하지만 최대 15% 이상의 회수 위험이 있습니다.
중요한 위험요소:
/*backtest
start: 2025-01-01 00:00:00
end: 2025-09-18 00:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":500000}]
*/
//@version=5
strategy("Zero Lag + ML SuperTrend Strategy (Multi-Symbol)", overlay=true,
default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === Inputs ===
length = input.int(70, "Zero Lag Length")
mult = input.float(1.2, "Band Multiplier")
atrPeriod = input.int(14, "ATR Period (SuperTrend)")
factor = input.float(3.0, "ATR Multiplier (SuperTrend)")
tpPerc = input.float(1.0, "Take Profit %")
slPerc = input.float(0.5, "Stop Loss %")
// === Symbol Info ===
sym = syminfo.ticker
// === Zero Lag Trend ===
src = close
lag = math.floor((length - 1) / 2)
zlema = ta.ema(src + (src - src[lag]), length)
volatility = ta.highest(ta.atr(length), length*3) * mult
bullZL = close > zlema + volatility
bearZL = close < zlema - volatility
// === ML SuperTrend ===
atr = ta.atr(atrPeriod)
upperband = hl2 + factor * atr
lowerband = hl2 - factor * atr
var float trend = na
if close > nz(trend[1], hl2)
trend := math.max(lowerband, nz(trend[1], hl2))
else
trend := math.min(upperband, nz(trend[1], hl2))
bullST = close > trend
bearST = close < trend
// === Combined Signals ===
longEntry = bullZL and bullST
shortEntry = bearZL and bearST
// === Strategy Execution ===
if (longEntry)
strategy.entry("Long", strategy.long)
if (shortEntry)
strategy.entry("Short", strategy.short)
// Exit conditions (fixed SL & TP)
longSL = strategy.position_avg_price * (1 - slPerc/100)
longTP = strategy.position_avg_price * (1 + tpPerc/100)
shortSL = strategy.position_avg_price * (1 + slPerc/100)
shortTP = strategy.position_avg_price * (1 - tpPerc/100)
strategy.exit("Exit Long", from_entry="Long", stop=longSL, limit=longTP)
strategy.exit("Exit Short", from_entry="Short", stop=shortSL, limit=shortTP)
// === Plotting ===
plot(zlema, "ZeroLagEMA", color=color.yellow)
plot(trend, "SuperTrend", color=color.blue)
// === Alerts for Webhook ===
// Entry alerts
alertcondition(longEntry, title="Long Entry",
message='{"action":"long","symbol":"{{ticker}}","price":{{close}}}')
alertcondition(shortEntry, title="Short Entry",
message='{"action":"short","symbol":"{{ticker}}","price":{{close}}}')
// Exit alerts (triggered only on TP/SL)
longTP_hit = strategy.position_size <= 0 and close >= longTP
longSL_hit = strategy.position_size <= 0 and close <= longSL
shortTP_hit = strategy.position_size >= 0 and close <= shortTP
shortSL_hit = strategy.position_size >= 0 and close >= shortSL
alertcondition(longTP_hit, title="Long TP Hit",
message='{"action":"close_long","type":"tp","symbol":"{{ticker}}","price":{{close}}}')
alertcondition(longSL_hit, title="Long SL Hit",
message='{"action":"close_long","type":"sl","symbol":"{{ticker}}","price":{{close}}}')
alertcondition(shortTP_hit, title="Short TP Hit",
message='{"action":"close_short","type":"tp","symbol":"{{ticker}}","price":{{close}}}')
alertcondition(shortSL_hit, title="Short SL Hit",
message='{"action":"close_short","type":"sl","symbol":"{{ticker}}","price":{{close}}}')