
이 전략은 부린밴드 및 RSI 지표에 기반한 동적 돌파구 거래 시스템이다. 부린밴드의 변동성 분석과 RSI의 동적 확인을 결합하여 포괄적인 거래 의사 결정 프레임워크를 구축한다. 전략은 다방향 거래 제어를 지원하며, 시장 상황에 따라 더 많은, 적자 또는 양방향 거래를 선택할 수 있다. 시스템은 위험-이익 비율을 사용하여 각 거래의 중지 손실 및 수익 목표를 정확하게 제어하고 거래 관리의 체계화를 실현한다.
전략의 핵심 원칙은 다중 신호 확인을 통해 높은 확률의 돌파 거래 기회를 식별하는 것입니다. 구체적으로:
이것은 합리적이고 논리적으로 명확하게 설계된 돌파구 거래 전략이다. 다중 신호 확인과 개선된 위험 관리 메커니즘을 통해 전략은 더 나은 실용성을 가지고 있다. 동시에, 전략은 풍부한 최적화 공간을 제공하며, 특정 거래 품종과 시장 환경에 따라 타겟팅 된 개선을 할 수 있다. 실제 사용 전에 충분한 매개 변수 최적화 및 재검토를 수행하는 것이 좋습니다.
/*backtest
start: 2023-12-05 00:00:00
end: 2024-12-04 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Breakout Strategy with Direction Control", overlay=true)
// === Input Parameters ===
length = input(20, title="Bollinger Bands Length")
src = close
mult = input(2.0, title="Bollinger Bands Multiplier")
rsi_length = input(14, title="RSI Length")
rsi_midline = input(50, title="RSI Midline")
risk_reward_ratio = input(2.0, title="Risk/Reward Ratio")
// === Trade Direction Option ===
trade_direction = input.string("Both", title="Trade Direction", options=["Long", "Short", "Both"])
// === Bollinger Bands Calculation ===
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper_band = basis + dev
lower_band = basis - dev
// === RSI Calculation ===
rsi_val = ta.rsi(src, rsi_length)
// === Breakout Conditions ===
// Long: Prijs sluit boven de bovenste Bollinger Band en RSI > RSI Midline
long_condition = close > upper_band and rsi_val > rsi_midline and (trade_direction == "Long" or trade_direction == "Both")
// Short: Prijs sluit onder de onderste Bollinger Band en RSI < RSI Midline
short_condition = close < lower_band and rsi_val < rsi_midline and (trade_direction == "Short" or trade_direction == "Both")
// === Entry Prices ===
var float entry_price_long = na
var float entry_price_short = na
if (long_condition)
entry_price_long := close
strategy.entry("Long", strategy.long, when=long_condition)
if (short_condition)
entry_price_short := close
strategy.entry("Short", strategy.short, when=short_condition)
// === Stop-Loss and Take-Profit ===
long_stop_loss = entry_price_long * 0.98 // 2% onder instapprijs
long_take_profit = entry_price_long * (1 + (0.02 * risk_reward_ratio))
short_stop_loss = entry_price_short * 1.02 // 2% boven instapprijs
short_take_profit = entry_price_short * (1 - (0.02 * risk_reward_ratio))
if (strategy.position_size > 0) // Long Positie
strategy.exit("Exit Long", "Long", stop=long_stop_loss, limit=long_take_profit)
if (strategy.position_size < 0) // Short Positie
strategy.exit("Exit Short", "Short", stop=short_stop_loss, limit=short_take_profit)
// === Plotting ===
plot(upper_band, color=color.green, title="Upper Band")
plot(lower_band, color=color.red, title="Lower Band")
plot(basis, color=color.blue, title="Basis")