
Chiến lược này là một hệ thống giao dịch tự điều chỉnh kết hợp các dải Bollinger Bands và chỉ số tương đối yếu RSI. Chiến lược này xác định các cơ hội giao dịch tiềm năng thông qua các kênh giá Bollinger Bands và tín hiệu mua bán quá mức của RSI để nắm bắt xu hướng và biến động của thị trường. Chiến lược này sử dụng các phân biệt tiêu chuẩn để điều chỉnh động giao dịch giữa các vùng và kết hợp với các mức mua bán quá mức của chỉ số RSI để xác nhận tín hiệu giao dịch, do đó cải thiện độ chính xác của giao dịch.
Trung tâm của chiến lược này là nắm bắt cơ hội biến động của thị trường bằng cách kết hợp các chỉ số RSI với đường quỹ đạo lên, giữa và xuống của Brin. Brin dựa trên trung bình di chuyển 20 chu kỳ và tính toán chênh lệch chuẩn gấp 2 lần. RSI sử dụng tính toán 14 chu kỳ, đặt 70 là mức quá mua và 30 là mức quá bán.
Chiến lược này xây dựng một hệ thống giao dịch tương đối hoàn chỉnh bằng cách sử dụng sự kết hợp của Brin và RSI. Ưu điểm của chiến lược là có thể thích ứng với biến động thị trường và cung cấp tín hiệu giao dịch đáng tin cậy, nhưng vẫn cần chú ý đến ảnh hưởng của môi trường thị trường đối với hiệu suất chiến lược.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-09 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Bollinger Bands and RSI Strategy with Buy/Sell Signals", overlay=true)
// Input settings
bb_length = input.int(20, title="Bollinger Bands Length", minval=1)
bb_mult = input.float(2.0, title="Bollinger Bands Multiplier", minval=0.1)
rsi_length = input.int(14, title="RSI Length", minval=1)
rsi_overbought = input.int(70, title="RSI Overbought Level", minval=50)
rsi_oversold = input.int(30, title="RSI Oversold Level", minval=1)
// Bollinger Bands calculation
basis = ta.sma(close, bb_length)
dev = bb_mult * ta.stdev(close, bb_length)
upper_band = basis + dev
lower_band = basis - dev
// RSI calculation
rsi = ta.rsi(close, rsi_length)
// Buy signal: Price touches lower Bollinger Band and RSI is oversold
buy_signal = ta.crossover(close, lower_band) and rsi < rsi_oversold
// Sell signal: Price touches upper Bollinger Band and RSI is overbought
sell_signal = ta.crossunder(close, upper_band) and rsi > rsi_overbought
// Execute orders
if (buy_signal)
strategy.entry("Buy", strategy.long)
if (sell_signal)
strategy.close("Buy")
// Plotting Bollinger Bands and RSI
plot(upper_band, color=color.red, linewidth=2, title="Upper Band")
plot(lower_band, color=color.green, linewidth=2, title="Lower Band")
plot(basis, color=color.blue, linewidth=1, title="Middle Band")
hline(rsi_overbought, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(rsi_oversold, "Oversold", color=color.green, linestyle=hline.style_dashed)
plot(rsi, "RSI", color=color.orange)
// Add Buy/Sell signals on the chart
plotshape(series=buy_signal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sell_signal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")