
この戦略は,5分間の開盤突破をベースとする定量取引システムで,ATR指標と組み合わせて動的なストップ・ストラップ・マネジメントを行う.戦略は,主に開盤後最初の5分間のK線の高低点を重要な価格区間として認識し,価格がこの区間突破すると取引シグナルを誘発し,ATRベースの動的なストラップを使用してリスクを制御する.
戦略の中核となるロジックには、次の主要なステップが含まれます。
これは,構造が整った,論理が明確な量化取引戦略であり,開設価格の突破を監視し,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)