
Chiến lược này là một hệ thống giao dịch phân tích kỹ thuật kết hợp các dải Bollinger Bands và các chỉ số tương đối mạnh RSI. Nó chủ yếu sử dụng tính năng biến động giá và động lực thị trường để tìm kiếm cơ hội giao dịch trong khu vực mua bán quá mức. Chiến lược này tạo ra tín hiệu mua khi chỉ số RSI hiển thị bán quá mức dưới 30 và giá phá vỡ đường dây Bollinger Bands; tạo ra tín hiệu bán khi chỉ số RSI hiển thị mua quá mức trên 70 và giá phá vỡ đường dây Bollinger Bands.
Logic cốt lõi của chiến lược này dựa trên các yếu tố chính sau:
Chiến lược này được kết hợp với các chỉ số Brin và RSI để xây dựng một hệ thống giao dịch tương đối hoàn chỉnh. Logic của chiến lược rõ ràng, kiểm soát rủi ro hợp lý và có giá trị thực tế nhất định. Với hướng tối ưu hóa được đề xuất, chiến lược vẫn còn chỗ để nâng cao hơn nữa.
/*backtest
start: 2024-07-15 00:00:00
end: 2025-02-18 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Binance","currency":"BNB_USDT"}]
*/
//@version=5
strategy("Bollinger Bands + RSI Strategy", overlay=true)
// Bollinger Bands parameters
length = input.int(20, title="Bollinger Bands Length")
src = input(close, title="Source")
mult = input.float(2.0, title="Bollinger Bands Multiplier")
basis = ta.sma(src, length)
dev = mult * ta.stdev(src, length)
upper_band = basis + dev
lower_band = basis - dev
// RSI parameters
rsi_length = input.int(14, title="RSI Length")
rsi = ta.rsi(src, rsi_length)
// Plot Bollinger Bands
plot(upper_band, color=color.red, linewidth=2, title="Upper Bollinger Band")
plot(lower_band, color=color.green, linewidth=2, title="Lower Bollinger Band")
plot(basis, color=color.blue, linewidth=1, title="Middle Band")
// Buy Condition
buy_condition = ta.crossover(close, lower_band) and rsi < 30
if buy_condition
strategy.entry("Buy", strategy.long)
// Sell Condition
sell_condition = ta.crossunder(close, upper_band) and rsi > 70
if sell_condition
strategy.entry("Sell", strategy.short)
// Exit Conditions (optional: use the middle Bollinger Band for exits)
exit_condition = ta.cross(close, basis)
if exit_condition
strategy.close("Buy")
strategy.close("Sell")
// Optional: Plot RSI for additional insight
hline(70, "Overbought", color=color.red)
hline(30, "Oversold", color=color.green)
plot(rsi, color=color.purple, title="RSI", linewidth=1, offset=-5)