OPEN-SOURCE SCRIPT

Breakout Trading Strategy

83
//version=6
strategy("Breakout Trading Strategy", overlay=true)

// ✅ 파라미터 설정
length = 20 // 최근 20개 캔들 기준 돌파 확인
vol_length = 10 // 최근 10개 캔들 평균 거래량 비교
atr_mult = 1.5 // 손절(ATR 기준)
risk_reward = 2 // 손익비 1:2

// ✅ 지표 계산
high_break = ta.highest(high, length)
low_break = ta.lowest(low, length)
vol_avg = ta.sma(volume, vol_length)
ema50 = ta.ema(close, 50)
atr_val = ta.atr(14)

// ✅ 진입 조건
long_condition = ta.crossover(close, high_break) and volume > vol_avg * 1.3 and close > ema50
short_condition = ta.crossunder(close, low_break) and volume > vol_avg * 1.3 and close < ema50

// ✅ 손절 및 익절 설정
long_sl = close - atr_mult * atr_val
long_tp = close + (atr_mult * atr_val * risk_reward)
short_sl = close + atr_mult * atr_val
short_tp = close - (atr_mult * atr_val * risk_reward)

// ✅ 트레이드 실행
if long_condition
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit", from_entry="Long", limit=long_tp, stop=long_sl)

if short_condition
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit", from_entry="Short", limit=short_tp, stop=short_sl)

// ✅ 시각적 표시
plot(high_break, color=color.green, title="High Breakout Level")
plot(low_break, color=color.red, title="Low Breakout Level")

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.