
이 전략은 5분 오픈 브레이크를 기반으로 한 양적 거래 시스템으로 ATR 지표와 결합하여 동적 스톱 스톱 손실 관리를 수행합니다. 전략은 주로 오픈 후 첫 번째 5분 K 선의 높은 낮은 점을 중요한 가격 범위로 식별하여 가격이 이 범위를 돌파 할 때 거래 신호를 유발하고 ATR 기반의 동적 스톱 손실을 사용하여 위험을 제어합니다.
전략의 핵심 논리에는 다음과 같은 주요 단계가 포함됩니다.
이 전략의 핵심 장점은 간단하고 효과적인 설계 개념이지만, 다양한 시장 환경과 거래 유형에 대한 지속적인 최적화가 필요합니다. 거래자는 실제 사용 전에 충분한 피드백 검증을 수행하고 실제 상황에 따라 매개 변수 설정을 조정하는 것이 좋습니다.
/*backtest
start: 2025-02-13 00:00:00
end: 2025-02-19 00:00:00
period: 5m
basePeriod: 5m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("5-Min Open Candle Breakout", overlay=true)
// Get the current bar's year, month, and day
currentYear = year
currentMonth = month
currentDay = dayofmonth
// Define session start time (adjust based on market)
sessionStart = timestamp(currentYear, currentMonth, currentDay, 9, 30) // 9:30 AM for NYSE
// Identify the first 5-minute candle
isFirstCandle = (time >= sessionStart and time < sessionStart + 300000) // 5 min = 300,000 ms
var float openPrice = na
var float highPrice = na
var float lowPrice = na
if isFirstCandle
openPrice := open
highPrice := high
lowPrice := low
// Breakout Conditions
longEntry = ta.crossover(close, highPrice)
shortEntry = ta.crossunder(close, lowPrice)
// Define Stop Loss & Take Profit (Ratio 1:1.5)
slFactor = 1.0 // Stop Loss Multiplier
tpFactor = 1.5 // Take Profit Multiplier
atrValue = ta.atr(14) // Fix: Use ta.atr() instead of atr()
longSL = lowPrice - atrValue * slFactor
longTP = highPrice + (highPrice - lowPrice) * tpFactor
shortSL = highPrice + atrValue * slFactor
shortTP = lowPrice - (highPrice - lowPrice) * tpFactor
// Execute Trades
strategy.entry("Long", strategy.long, when=longEntry)
strategy.exit("Exit Long", from_entry="Long", stop=longSL, limit=longTP)
strategy.entry("Short", strategy.short, when=shortEntry)
strategy.exit("Exit Short", from_entry="Short", stop=shortSL, limit=shortTP)
// Plot High/Low of First Candle
plot(highPrice, title="First 5m High", color=color.green, linewidth=2)
plot(lowPrice, title="First 5m Low", color=color.red, linewidth=2)