This strategy is a dual technical analysis trading system based on the Relative Strength Index (RSI) and Bollinger Bands. The strategy combines RSI’s overbought/oversold signals with Bollinger Bands’ price channel breakout signals to construct a complete trading decision framework. It is particularly suitable for markets with high volatility, achieving risk-controlled trading through strict entry and exit conditions.
The core logic is built on the synergy of two main technical indicators:
This strategy builds a relatively complete trading system through the synergy of RSI and Bollinger Bands. Its main advantages lie in the dual confirmation mechanism and comprehensive risk control, while attention must be paid to market environment impacts. The proposed optimization directions can further enhance strategy stability and profitability.
/*backtest start: 2019-12-23 08:00:00 end: 2024-11-28 00:00:00 period: 2d basePeriod: 2d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("RSI与布林带双重策略 (by ChartArt) v2.2", shorttitle="CA_RSI_布林带策略_2.2", overlay=true) // ChartArt的RSI + 布林带双重策略 - 精简版 // // 中文版本 3, BY Henry // 原创意来自ChartArt,2015年1月18日 // 更新至Pine Script v5版本,删除了背景色、K线颜色和策略收益绘制功能 // // 策略说明: // 该策略结合使用RSI指标和布林带。 // 当价格高于上轨且RSI超买时卖出, // 当价格低于下轨且RSI超卖时买入。 // // 本策略仅在RSI和布林带同时 // 处于超买或超卖状态时触发。 // === 输入参数 === // RSI参数 RSIlength = input.int(6, title="RSI周期长度", minval=1) RSIoverSold = input.int(50, title="RSI超卖阈值", minval=0, maxval=100) RSIoverBought = input.int(50, title="RSI超买阈值", minval=0, maxval=100) // 布林带参数 BBlength = input.int(200, title="布林带周期长度", minval=1) BBmult = input.float(2.0, title="布林带标准差倍数", minval=0.001, maxval=50) // === 计算 === price = close vrsi = ta.rsi(price, RSIlength) // 布林带计算 BBbasis = ta.sma(price, BBlength) BBdev = BBmult * ta.stdev(price, BBlength) BBupper = BBbasis + BBdev BBlower = BBbasis - BBdev // === 绘图 === plot(BBbasis, color=color.new(color.aqua, 0), title="布林带中线(SMA)") p1 = plot(BBupper, color=color.new(color.silver, 0), title="布林带上轨") p2 = plot(BBlower, color=color.new(color.silver, 0), title="布林带下轨") fill(p1, p2, color=color.new(color.silver, 90)) // === 策略逻辑 === if (not na(vrsi)) longCondition = ta.crossover(vrsi, RSIoverSold) and ta.crossover(price, BBlower) if (longCondition) strategy.entry("RSI_BB_做多", strategy.long, stop=BBlower, oca_name="RSI_BB", comment="RSI_BB_做多") else strategy.cancel("RSI_BB_做多") shortCondition = ta.crossunder(vrsi, RSIoverBought) and ta.crossunder(price, BBupper) if (shortCondition) strategy.entry("RSI_BB_做空", strategy.short, stop=BBupper, oca_name="RSI_BB", comment="RSI_BB_做空") else strategy.cancel("RSI_BB_做空")