
Chiến lược này là một hệ thống giao dịch đột phá động dựa trên các chỉ số Brin và RSI. Nó xây dựng một khung quyết định giao dịch toàn diện bằng cách kết hợp phân tích biến động của Brin với xác nhận động lực của RSI. Chiến lược hỗ trợ kiểm soát giao dịch đa hướng, có thể lựa chọn giao dịch nhiều, ngắn hoặc hai chiều tùy theo tình hình thị trường. Hệ thống sử dụng tỷ lệ lợi nhuận rủi ro để kiểm soát chính xác mục tiêu dừng lỗ và lợi nhuận cho mỗi giao dịch, thực hiện hệ thống hóa quản lý giao dịch.
Nguyên tắc cốt lõi của chiến lược là xác định các cơ hội giao dịch đột phá có xác suất cao thông qua xác nhận nhiều tín hiệu. Cụ thể:
Đây là một chiến lược giao dịch đột phá được thiết kế hợp lý, logic rõ ràng. Chiến lược có khả năng thực tiễn tốt thông qua xác nhận tín hiệu đa và cơ chế quản lý rủi ro tốt. Đồng thời, chiến lược cung cấp nhiều không gian tối ưu hóa, có thể được cải tiến có mục tiêu theo các loại giao dịch cụ thể và môi trường thị trường.
/*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")