
EMA, ATR, MOMENTUM, EFFICIENCY, BREAKOUT
겉으로 보이는 18/50/120 3평균선 설정에 속지 마십시오. 이 전략의 핵심은 8개의 독립적인 차원의 트렌드 검증 시스템이며, 각 차원은 명확한 수치 기준을 가지고 있습니다. 단순한 금 포크의 사다리 대신, 중화 점수 메커니즘을 통해 트렌드 품질을 판단하십시오.
전통적인 평균선 전략의 문제는 가짜 신호가 너무 많다는 점입니다. 이 시스템은 경로 효율성 ((최소한 33%) 과 동력 지속성 ((K선 비율이 57% 이상 상승) 과 변동률 상태 ((ATR 비율이 95% 이상) 와 같은 여러 가지 필터링을 통해 입장 성공률을 새로운 수준으로 끌어 올립니다.
시장에서 90%의 돌파구는 가짜 돌파구이다. 이 전략은 돌파구 강도가 0.15배의 ATR에 도달해야 함을 설정하고, 이는 돌파구가 최근 평균 변동의 15%를 초과해야 유효한 신호로 인정된다는 것을 의미한다.
회귀 회수 메커니즘은 더 정교합니다: 가격의 빠른 라인에서 최소 0.9배의 ATR의 깊이 회정을 요구하고, 다시 평균 라인에 서면하면 0.15배의 ATR에 도달합니다. 이 디자인은 은 가짜 돌파구를 효과적으로 필터링하여 실제 자금에 의한 트렌드 시작만을 포착합니다.
2배의 레버리지 설정은 과격하게 보이지만 2%의 하드 스톱과 2.8배의 ATR 동적 추적을 통해 실제 위험을 조절할 수 있습니다. 더 중요한 것은 20.8배의 ATR의 이익 잠금 메커니즘입니다. 유동성이 이 수준에 도달하면 자동으로 스톱을 올리고 큰 추세에서 이익이 회전되지 않도록합니다.
강제 입점 1개의 완전한 K선 디자인은 고주파 입출력을 막고, 5개의 K선 냉각기는 감정적인 연속 거래를 피한다. 이 리듬 조절은 순수 기술적인 지표보다 더 중요하다.
트렌드 계속 입문: 이미 확립된 강력한 트렌드에 적용하여, 돌파 + 경사 + 효율 + 동력이 모두 충족되어야 한다. 재조정 재입문: 건강한 트렌드에 대한 재조정, 충분한 깊이를 요구하고 힘을 되찾아야 한다. 초기 트렌드 입문: 트렌드 전환의 황금 14 K 선 창 기간을 잡는다.
이러한 다중 모드 디자인의 장점은 어떤 종류의 트렌드 기회도 놓치지 않는다는 점이며, 각 모드마다 엄격한 품질 기준이 있다는 것입니다.
경로 효율성은 18주기 동안의 순 이동과 누적 이동의 비율을 계산하고, 33% 이하의 추세는 상쇄되지 않습니다. 이 지표는 충격적인 상황에서 가짜 추세를 효과적으로 식별하여横盘 시장에서 반복적으로 상쇄되는 것을 피할 수 있습니다.
동력 지속성은 57% 이상의 K선 수평을 요구하며, 12주기 동력과 함께 반드시 긍정적이어야 한다. 이 이중 검증은 가격의 표면적 돌파가 아니라 트렌드의 내적 강도를 보장한다.
이 전략은 트렌드 시장에 유리한 것으로 나타났으며, 불안정한 상황에서는 출전 신호를 자주 쏘아 올린다. ATR 상태가 80% 이하이고 효율성이 25% 이하일 때 출전을 강제하는 디자인은 전략이 시장 환경에 대한 명확한 요구가 있음을 나타낸다.
가장 큰 위험은 트렌드 전환 기간의 지연성입니다. 빠른 EMA 교차와 같은 조기 경고가 있지만 급격한 반전에서는 여전히 큰 반전이 발생할 수 있습니다. 성장 주식이나 암호화폐 시장에서 높은 변동률을 사용하는 것이 좋습니다. 대장 블루칩과 같은 낮은 변동성 품종에 적용하는 것은 피하십시오.
위험 팁: 역사적인 회귀는 미래의 수익을 의미하지 않습니다. 전략은 연속적인 손실 위험이 있습니다. 위험 관리가 엄격하게 수행되어야합니다.
/*backtest
start: 2026-01-07 15:30:00
end: 2026-03-15 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"XAG_USDT","balance":500000}]
*/
//@version=5
strategy("Quant Trend Engine Long Only v2 - Manual Leverage Fixed", overlay=true)
// === Core lengths ===
fastLen = input.int(18, "Fast EMA")
midLen = input.int(50, "Mid EMA")
slowLen = input.int(120, "Slow EMA")
smoothLen = input.int(3, "EMA Smoothing")
pullbackLen = input.int(8, "Pullback Lookback")
breakoutLen = input.int(20, "Breakout Length")
effLen = input.int(18, "Efficiency Length")
persistLen = input.int(7, "Persistence Length")
momLen = input.int(12, "Momentum Length")
slopeLen = input.int(10, "Slope Length")
atrLen = input.int(14, "ATR Length")
atrBaseLen = input.int(40, "ATR Baseline Length")
// === Thresholds ===
minScore = input.float(5.0, "Minimum Entry Score", step=0.25)
exitScore = input.float(2.5, "Weak Trend Exit Score", step=0.25)
minSepPerc = input.float(0.30, "Min EMA Separation %", step=0.05)
minSlowSlopePerc = input.float(0.03, "Min Slow Slope %", step=0.01)
minEff = input.float(0.33, "Min Efficiency", step=0.01)
minAtrRegime = input.float(0.95, "Min ATR Regime", step=0.05)
minBreakoutAtr = input.float(0.15, "Min Breakout ATR Strength", step=0.05)
pullbackAtrMult = input.float(0.90, "Pullback Distance ATR", step=0.05)
reclaimAtrMult = input.float(0.15, "Reclaim Distance ATR", step=0.05)
cooldownBars = input.int(5, "Cooldown Bars After Exit")
// === Risk ===
leverage = input.float(2.0, "Leverage", step=0.1, minval=0.1)
hardStopPerc = input.float(2.0, "Hard Stop %", step=0.1)
trailAtrMult = input.float(2.8, "ATR Trail Mult", step=0.1)
profitLockAtrMult = input.float(20.8, "Profit Lock ATR Mult", step=0.1)
// === Smoothed EMAs ===
fast = ta.ema(ta.ema(close, fastLen), smoothLen)
mid = ta.ema(ta.ema(close, midLen), smoothLen)
slow = ta.ema(ta.ema(close, slowLen), smoothLen)
// === Regime structure ===
bullStack = fast > mid and mid > slow
sepPerc = slow != 0 ? math.abs(fast - slow) / slow * 100 : 0.0
sepOk = sepPerc >= minSepPerc
fastSlope = fast[slopeLen] != 0 ? (fast - fast[slopeLen]) / fast[slopeLen] * 100 : 0.0
midSlope = mid[slopeLen] != 0 ? (mid - mid[slopeLen]) / mid[slopeLen] * 100 : 0.0
slowSlope = slow[slopeLen] != 0 ? (slow - slow[slopeLen]) / slow[slopeLen] * 100 : 0.0
slopeOk = slowSlope >= minSlowSlopePerc and midSlope > 0 and fastSlope > 0
// === Path efficiency ===
netMove = math.abs(close - close[effLen])
stepMove = 0.0
for i = 1 to effLen
stepMove += math.abs(close[i - 1] - close[i])
efficiency = stepMove != 0 ? netMove / stepMove : 0.0
effOk = efficiency >= minEff
// === Momentum persistence ===
upBars = 0.0
for i = 0 to persistLen - 1
upBars += close[i] > close[i + 1] ? 1 : 0
persistRatio = persistLen > 0 ? upBars / persistLen : 0.0
momRaw = close[momLen] != 0 ? (close - close[momLen]) / close[momLen] * 100 : 0.0
momOk = momRaw > 0 and persistRatio >= 0.57
// === Volatility regime ===
atr = ta.atr(atrLen)
atrBase = ta.sma(atr, atrBaseLen)
atrRegime = atrBase != 0 ? atr / atrBase : 0.0
atrOk = atrRegime >= minAtrRegime
// === Breakout quality ===
hh = ta.highest(high, breakoutLen)[1]
breakoutDist = close - hh
breakoutStrength = atr != 0 ? breakoutDist / atr : 0.0
breakoutOk = close > hh and breakoutStrength >= minBreakoutAtr
// === Pullback / reclaim logic ===
pullbackLow = ta.lowest(low, pullbackLen)
distFromFastAtr = atr != 0 ? (fast - pullbackLow) / atr : 0.0
deepEnoughPullback = distFromFastAtr >= pullbackAtrMult
reclaimFast = close > fast and close[1] <= fast[1]
reclaimMid = close > mid and close[1] <= mid[1]
reclaimStrength = atr != 0 ? (close - fast) / atr : 0.0
reclaimOk = (reclaimFast or reclaimMid) and reclaimStrength >= reclaimAtrMult
// === Transition memory ===
bullCross = ta.crossover(fast, mid) or ta.crossover(fast, slow) or ta.crossover(mid, slow)
barsSinceBullCross = ta.barssince(bullCross)
recentTrendBirth = barsSinceBullCross >= 0 and barsSinceBullCross <= 14
// === Weighted score ===
trendScore = 0.0
trendScore += bullStack ? 1.50 : 0.0
trendScore += sepOk ? 0.90 : 0.0
trendScore += slopeOk ? 1.10 : 0.0
trendScore += effOk ? 1.00 : 0.0
trendScore += atrOk ? 0.80 : 0.0
trendScore += momOk ? 1.00 : 0.0
trendScore += breakoutOk ? 1.25 : 0.0
trendScore += reclaimOk ? 1.10 : 0.0
// === Entry models ===
trendContinuationEntry = bullStack and breakoutOk and slopeOk and effOk and momOk
pullbackReentry = bullStack and sepOk and slopeOk and deepEnoughPullback and reclaimOk and effOk
earlyTrendEntry = recentTrendBirth and bullStack and sepOk and slopeOk and atrOk and momOk
// === Cooldown ===
var int lastExitBar = na
cooldownOk = na(lastExitBar) or bar_index - lastExitBar > cooldownBars
// === Final entry ===
enterLong = strategy.position_size == 0 and cooldownOk and trendScore >= minScore and close > slow and (trendContinuationEntry or pullbackReentry or earlyTrendEntry)
// === Manual leveraged sizing only ===
equity = math.max(strategy.equity, 0)
positionValue = equity * leverage
qty = positionValue > 0 ? positionValue / (close * syminfo.pointvalue) : 0.0
// === Entry tracking / mandatory 1 full candle hold ===
var int entryBarIndex = na
justOpened = strategy.position_size > 0 and strategy.position_size[1] == 0
if justOpened
entryBarIndex := bar_index
canExitNow = strategy.position_size > 0 and not na(entryBarIndex) and bar_index > entryBarIndex
// === Entry order ===
if enterLong and qty > 0
strategy.entry("Long", strategy.long, qty=qty)
// === Risk logic ===
hardStopPrice = strategy.position_size > 0 ? strategy.position_avg_price * (1 - hardStopPerc / 100) : na
var float trailStop = na
var float highSinceEntry = na
highSinceEntry := strategy.position_size > 0 ? (na(highSinceEntry) ? high : math.max(highSinceEntry, high)) : na
rawTrail = strategy.position_size > 0 ? close - atr * trailAtrMult : na
profitLock = strategy.position_size > 0 ? highSinceEntry - atr * profitLockAtrMult : na
combinedTrail = strategy.position_size > 0 ? math.max(rawTrail, profitLock) : na
trailStop := strategy.position_size > 0 ? (na(trailStop) ? combinedTrail : math.max(trailStop, combinedTrail)) : na
// === Exit logic ===
bearCross = ta.crossunder(fast, mid) or ta.crossunder(fast, slow)
structureBreak = close < mid and fast < mid
scoreWeak = trendScore <= exitScore
momentumFailure = persistRatio < 0.40 and momRaw < 0
regimeFailure = atrRegime < 0.80 and efficiency < 0.25
exitLong = strategy.position_size > 0 and canExitNow and (bearCross or structureBreak or scoreWeak or momentumFailure or regimeFailure)
// Only allow stop/trailing exits after 1 full candle has passed
if strategy.position_size > 0 and canExitNow
strategy.exit("Risk Exit", from_entry="Long", stop=math.max(hardStopPrice, trailStop))
justClosed = strategy.position_size[1] > 0 and strategy.position_size == 0
if justClosed
lastExitBar := bar_index
trailStop := na
highSinceEntry := na
entryBarIndex := na
if exitLong
strategy.close("Long")
// === Plots ===
plot(fast, color=color.green, linewidth=2, title="Fast EMA")
plot(mid, color=color.orange, linewidth=2, title="Mid EMA")
plot(slow, color=color.red, linewidth=2, title="Slow EMA")
plot(strategy.position_size > 0 ? trailStop : na, color=color.blue, linewidth=2, title="Adaptive Trail")
plot(trendScore, title="Trend Score", color=color.aqua)
plot(efficiency, title="Efficiency", color=color.fuchsia)
plot(atrRegime, title="ATR Regime", color=color.yellow)
plot(breakoutStrength, title="Breakout Strength", color=color.lime)
plot(persistRatio, title="Persistence Ratio", color=color.white)