
트렌드 리커딩 조정 가능한 위험 동적 입점 전략은 단기 트렌드 전환 후의 리커딩에서 멀티 헤드 포지션을 구축하기를 희망하면서 시장 조건이 하향으로 유리한 경우 즉시 상공으로 진출하는 스윙 트레이더를 위해 설계되었습니다. 이 전략은 SMA 교차 확인 트렌드, 고정 백분율 리커딩 입점, 및 조정 가능한 위험 관리 매개 변수를 결합하여 최적의 거래 실행을 달성합니다.
전략의 핵심은 10주기 및 25주기 간단한 이동 평균 (SMA) 의 교차를 사용하여 트렌드 방향을 확인하고, 150주기 지수 이동 평균 (EMA) 과 결합하여 공허 거래의 추가 필터링 조건으로 둡니다. 멀티 헤드 거래는 SMA 교차 후 즉시 들어가지 않고, 가격이 지정된 퍼센트로 회귀한 후에 들어갑니다. 이러한 방법은 입문 가격을 최적화하고, 위험과 수익률을 높입니다.
이 전략의 작동 원리는 다음과 같은 몇 가지 핵심 부분으로 나눌 수 있습니다.
트렌드 확인 메커니즘:
다중 리콜 메커니즘:
텅 빈 머리 입학 규칙:
위험 관리 및 탈퇴 전략:
전략은 지속 가능한 변수를 사용하여 재개 신호를 추적하여 올바른 시간에 진입하도록합니다. 포지션이 없을 때 시스템은 다음 거래 신호를 준비하기 위해 모든 표시와 수준을 재설정합니다.
코드의 심층적인 분석을 통해, 이 전략은 다음과 같은 중요한 장점을 보여준다:
최적화된 입학 시점:
전체적인 위험 관리:
트렌드 조정 필터:
시각적 피드백:
매우 적응력이 좋다:
이 전략은 많은 장점들을 가지고 있지만, 다음과 같은 위험도 있습니다.
빠른 시장의 위험:
시장의 흔들림:
고정 점수 위험 관리의 한계:
기술적인 지표에 지나치게 의존하는 것:
매개변수 최적화 위험:
코드 분석을 바탕으로 이 전략이 최적화될 수 있는 몇 가지 주요 방향은 다음과 같습니다.
동적 위험 관리:
stopDistance = input.float(2.0) * ta.atr(14)계산 방법트렌드 강도 필터링:
다중 시간 프레임 분석:
스마트 리모드 인식:
거래량 확인:
적응 변수:
트렌드 회귀는 위험을 조정할 수 있습니다. 동적 입시 전략은 트렌드 식별, 입시 최적화 및 전체적인 위험 관리를 결합한 정교하게 설계된 거래 시스템입니다. 가격 회귀를 기다리며 다시 입시함으로써 전략은 간단한 SMA 교차 시스템보다 더 나은 입시 가격과 위험 수익률을 얻습니다.
이 전략의 핵심 장점은 개인 위험 선호와 시장 조건에 따라 변수를 조정할 수 있는 유연성과 조정성이라는 것입니다. 또한, 통합된 위험 관리 기능 (정지, 정지 및 경보점을 포함한) 은 전체적인 자금 보호를 제공합니다.
그러나, 이 전략은 또한 몇몇 제한이 있습니다. 격변 시장에서의 성과와 고정 점수 위험 관리의 제한을 포함합니다. 동적 위험 관리, 트렌드 강도 필터링 및 거래량 확인과 같은 권고의 최적화를 실행함으로써 전략의 안정성과 전반적인 성능을 크게 향상시킬 수 있습니다.
스윙 트레이더에게는 이상적인 기본 전략이며, 개인의 거래 스타일과 목표에 따라 추가적으로 조정할 수 있습니다. 합리적인 매개 변수 설정과 지속적인 모니터링 조정으로, 이 전략은 다양한 시장 환경에서 안정적인 거래 결과를 제공하는 잠재력을 가지고 있습니다.
/*backtest
start: 2024-08-01 00:00:00
end: 2025-03-25 00:00:00
period: 2h
basePeriod: 2h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT"}]
*/
//@version=6
strategy("BTCUSD with adjustable sl,tp",
overlay=true,
initial_capital=10000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=10,
calc_on_every_tick=true)
// ─────────────────────────────────────────────────────────────────────────────
// ▌ USER INPUTS
// ─────────────────────────────────────────────────────────────────────────────
longSignalStyle = input.string("Label Up", title="Long Signal Style", options=["Label Up", "Arrow Up", "Cross"])
shortSignalStyle = input.string("Label Down", title="Short Signal Style", options=["Label Down", "Arrow Down", "Cross"])
// Adjustable exit parameters (in points)
tpDistance = input.int(1000, "Take Profit Distance (points)", minval=1)
slDistance = input.int(250, "Stop Loss Distance (points)", minval=1)
beTrigger = input.int(500, "Break-Even Trigger Distance (points)", minval=1)
// Adjustable retracement percentage for long pullback entry (e.g. 0.01 = 1%)
retracementPct = input.float(0.01, "Retracement Percentage (e.g. 0.01 for 1%)", step=0.001)
// ─────────────────────────────────────────────────────────────────────────────
// ▌ INDICATORS: SMA & EMA
// ─────────────────────────────────────────────────────────────────────────────
sma10 = ta.sma(close, 10)
sma25 = ta.sma(close, 25)
ema150 = ta.ema(close, 150)
plot(sma10, color=color.blue, title="SMA 10")
plot(sma25, color=color.red, title="SMA 25")
plot(ema150, color=color.orange, title="EMA 150")
// ─────────────────────────────────────────────────────────────────────────────
// ▌ ENTRY CONDITIONS
// ─────────────────────────────────────────────────────────────────────────────
longCondition = ta.crossover(sma10, sma25)
shortCondition = ta.crossunder(sma10, sma25)
shortValid = close < ema150 // Only take shorts if price is below EMA150
// Plot immediate entry signals (for visual reference)
plotshape(longCondition and (strategy.position_size == 0), title="Long Signal",
style=(longSignalStyle == "Label Up" ? shape.labelup : (longSignalStyle == "Arrow Up" ? shape.triangleup : shape.cross)),
location=location.belowbar, color=color.green, text="Long", size=size.small)
plotshape(shortCondition and shortValid and (strategy.position_size == 0), title="Short Signal",
style=(shortSignalStyle == "Label Down" ? shape.labeldown : (shortSignalStyle == "Arrow Down" ? shape.triangledown : shape.cross)),
location=location.abovebar, color=color.red, text="Short", size=size.small)
// ─────────────────────────────────────────────────────────────────────────────
// ▌ LONG PULLBACK ENTRY USING FIXED PERCENTAGE RETRACEMENT
// ─────────────────────────────────────────────────────────────────────────────
// We use persistent variables to track the pullback signal.
var bool longSignalActive = false
var float pullHigh = na // highest high since long signal activation
var float retraceLevel = na // level = pullHigh * (1 - retracementPct)
// Only consider new entries when no position is open.
if strategy.position_size == 0
// When a long crossover occurs, activate the signal and initialize pullHigh.
if longCondition
longSignalActive := true
pullHigh := high
// If signal active, update pullHigh and compute retracement level.
if longSignalActive
pullHigh := math.max(pullHigh, high)
retraceLevel := pullHigh * (1 - retracementPct)
// When price bounces upward and crosses above the retracement level, enter long
if ta.crossover(close, retraceLevel)
strategy.entry("Long", strategy.long)
longSignalActive := false
// Short entries: enter immediately if conditions are met
if shortCondition and shortValid
strategy.entry("Short", strategy.short)
// ─────────────────────────────────────────────────────────────────────────────
// ▌ EXIT CONDITIONS WITH ADJUSTABLE TP, SL & BE
// ─────────────────────────────────────────────────────────────────────────────
var bool beLong = false
var bool beShort = false
// LONG EXIT LOGIC
if strategy.position_size > 0 and strategy.position_avg_price > 0
longEntry = strategy.position_avg_price
// Additional exit: if SMA(10) crosses below SMA(25) while price < EMA150, exit long
if ta.crossunder(sma10, sma25) and close < ema150
label.new(bar_index, low, "SMA Exit", style=label.style_label_down, color=color.red, textcolor=color.white)
strategy.close("Long", comment="SMA Cross Exit")
// Break-even trigger if price moves in favor by beTrigger points
if close >= longEntry + beTrigger
beLong := true
effectiveLongStop = beLong ? longEntry : (longEntry - slDistance)
if close <= effectiveLongStop
label.new(bar_index, low, (beLong ? "BE Hit" : "SL Hit"), style=label.style_label_down, color=color.red, textcolor=color.white)
strategy.close("Long", comment=(beLong ? "BE Hit" : "SL Hit"))
if close >= longEntry + tpDistance
label.new(bar_index, high, "TP Hit", style=label.style_label_up, color=color.green, textcolor=color.white)
strategy.close("Long", comment="TP Hit")
// SHORT EXIT LOGIC
if strategy.position_size < 0 and strategy.position_avg_price > 0
shortEntry = strategy.position_avg_price
// Basic stop logic
if close >= shortEntry + slDistance
label.new(bar_index, high, (beShort ? "BE Hit" : "SL Hit"), style=label.style_label_up, color=color.red, textcolor=color.white)
strategy.close("Short", comment=(beShort ? "BE Hit" : "SL Hit"))
// Take profit logic
if close <= shortEntry - tpDistance
label.new(bar_index, low, "TP Hit", style=label.style_label_down, color=color.green, textcolor=color.white)
strategy.close("Short", comment="TP Hit")
// Break-even trigger
if close <= shortEntry - beTrigger
beShort := true
effectiveShortStop = beShort ? shortEntry : (shortEntry + slDistance)
if close >= effectiveShortStop
label.new(bar_index, high, (beShort ? "BE Hit" : "SL Hit"), style=label.style_label_up, color=color.red, textcolor=color.white)
strategy.close("Short", comment=(beShort ? "BE Hit" : "SL Hit"))
// Reset BE flags when no position is open
if strategy.position_size == 0
beLong := false
beShort := false
// Reset the pullback signal
if not longSignalActive
pullHigh := na
retraceLevel := na