
이 전략은 볼린저 밴드, 변동성, 위험 관리를 결합한 추세 추종 시스템입니다. 주로 볼린저 밴드의 상단 및 하단 트랙을 가격이 어떻게 돌파하는지 모니터링하여 추세 기회를 포착하고, 동시에 ATR과 함께 포지션 크기를 동적으로 조정하여 정밀한 위험 관리를 달성합니다. 이 전략에는 변동성이 큰 시장에서 잘못된 신호를 효과적으로 걸러내기 위해 시장 통합 기간을 식별하는 메커니즘도 통합되어 있습니다.
이 전략은 다음과 같은 핵심 논리를 기반으로 운영됩니다.
이 전략은 볼린저 밴드 돌파를 통해 추세를 포착하고 이를 건전한 위험 관리 시스템과 결합합니다. 이 전략의 장점은 적응력이 강하고 위험이 통제 가능하다는 점이지만, 여전히 거짓 돌파구와 추세 반전의 위험에 주의해야 합니다. 추세 확인 지표 추가, 매개변수 조정 메커니즘 최적화 등을 통해 전략을 더욱 개선할 여지가 있습니다. 전반적으로 볼 때, 이는 명확한 논리와 강력한 실용성을 갖춘 추세 추종 전략입니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands Breakout Strategy", overlay=true)
// Input parameters
length = input(20, title="Bollinger Bands Length")
stdDev = input(2.0, title="Standard Deviation")
riskRewardRatio = input(2.0, title="Risk/Reward Ratio")
atrLength = input(14, title="ATR Length")
riskPercentage = input(1.0, title="Risk Percentage per Trade")
// Calculate Bollinger Bands
basis = ta.sma(close, length)
dev = stdDev * ta.stdev(close, length)
upperBand = basis + dev
lowerBand = basis - dev
// Calculate ATR for position sizing
atr = ta.atr(atrLength)
// Plot Bollinger Bands
plot(basis, color=color.blue, title="Basis")
plot(upperBand, color=color.red, title="Upper Band")
plot(lowerBand, color=color.green, title="Lower Band")
// Market Consolidation Detection
isConsolidating = (upperBand - lowerBand) < ta.sma(upperBand - lowerBand, length) * 0.5
// Breakout Conditions
longCondition = ta.crossover(close, upperBand) and not isConsolidating
shortCondition = ta.crossunder(close, lowerBand) and not isConsolidating
// Risk Management: Calculate position size
equity = strategy.equity
riskAmount = equity * (riskPercentage / 100)
positionSize = riskAmount / (atr * riskRewardRatio)
// Execute trades with risk management
if (longCondition)
strategy.entry("Long", strategy.long, qty=positionSize)
strategy.exit("Take Profit", from_entry="Long", limit=close + atr * riskRewardRatio, stop=close - atr)
if (shortCondition)
strategy.entry("Short", strategy.short, qty=positionSize)
strategy.exit("Take Profit", from_entry="Short", limit=close - atr * riskRewardRatio, stop=close + atr)
// Alert conditions for breakouts
alertcondition(longCondition, title="Long Breakout", message="Long breakout detected!")
alertcondition(shortCondition, title="Short Breakout", message="Short breakout detected!")