Skip to main content

BB_RSI Strategy In-Depth Analysis

Strategy Number: #453 (453rd out of 465 strategies)
Strategy Type: Bollinger Bands + RSI Oversold Rebound Strategy
Timeframe: 1 hour (1h)


1. Strategy Overview

BB_RSI is a classic technical analysis strategy combining Bollinger Bands with the Relative Strength Index (RSI). The strategy identifies price deviations using Bollinger Bands, determines oversold conditions with RSI, enters when price touches the lower Bollinger Band while RSI is not extremely oversold, and exits when price rebounds near the upper Bollinger Band.

Core Features

FeatureDescription
Buy Conditions1 independent buy signal (Lower Bollinger Band + RSI filter)
Sell Conditions1 base sell signal (Upper Bollinger Band + RSI filter)
Protection MechanismsFixed stoploss + Trailing stoploss
Timeframe1 hour
Dependenciestalib, qtpylib

2. Strategy Configuration Analysis

2.1 Base Risk Parameters

# ROI exit table
minimal_roi = {
"0": 0.4, # Immediate 40% profit
"335": 0.18834, # 18.834% profit after 335 minutes
"564": 0.07349, # 7.349% profit after 564 minutes
"1097": 0 # Break-even exit after 1097 minutes
}

# Stoploss settings
stoploss = -0.06491 # Fixed stoploss -6.491%

# Trailing stoploss
trailing_stop = True
trailing_stop_positive = 0.01036 # Activate trailing after 1.036% profit
trailing_stop_positive_offset = 0.02409 # Trigger stoploss on 2.409% pullback
trailing_only_offset_is_reached = False

Design Rationale:

  • ROI table uses a stepwise decreasing design, encouraging quick short-term profits
  • Fixed stoploss around 6.5%, controlling maximum single-trade loss
  • Trailing stoploss mechanism protects floating profits

2.2 Order Type Configuration

order_types = {
'buy': 'limit', # Limit buy
'sell': 'limit', # Limit sell
'stoploss': 'market', # Market stoploss
'stoploss_on_exchange': False
}

3. Buy Conditions Explained

3.1 Single Buy Condition

The strategy employs a simple single-condition buy logic:

dataframe.loc[
(
(dataframe['close'] < dataframe['bb_lowerband']) # Close below lower Bollinger Band
&
(dataframe['rsi'] > 7) # RSI greater than 7
),
'buy'] = 1

Logic Breakdown:

ConditionMeaningDesign Intent
close < bb_lowerbandPrice breaks below lower Bollinger BandCapture oversold opportunities
rsi > 7RSI not in extreme oversoldAvoid catching falling knives in extreme declines

Parameter Specifications:

  • Bollinger Bands: 20 periods, 1 standard deviation
  • RSI: Default 14 periods

3.2 Buy Logic Diagram

Price Position Illustration:

bb_upperband ← Upper Band
─────────────────

bb_middleband ← Middle Band

─────────────────
bb_lowerband ← Lower Band

★ Buy Zone (close < lower band AND RSI > 7)

4. Sell Logic Explained

4.1 Single Sell Signal

dataframe.loc[
(
(dataframe['close'] > dataframe['bb_upperband']) # Close above upper Bollinger Band
&
(dataframe['rsi'] > 74) # RSI greater than 74
),
'sell'] = 1

Logic Breakdown:

ConditionMeaningDesign Intent
close > bb_upperbandPrice breaks above upper Bollinger BandCapture overbought conditions
rsi > 74RSI indicates overboughtConfirm sell timing

4.2 Multi-Layer Exit Mechanism

The strategy employs three-layer exit protection:

Exit Priority: ROI → Trailing Stoploss → Fixed Stoploss → Signal Sell

1. ROI Exit: Decreasing profit targets based on holding time
2. Trailing Stoploss: Activates after 1.036% profit, triggers on 2.409% pullback
3. Fixed Stoploss: Forced exit when loss exceeds 6.491%
4. Signal Sell: Price breaks above upper band AND RSI > 74

5. Technical Indicator System

5.1 Core Indicators

Indicator CategorySpecific IndicatorParametersUsage
Trend IndicatorBollinger Bands (BB)20 periods, 1 std devPrice channel identification
Momentum IndicatorRelative Strength Index (RSI)14 periodsOverbought/oversold judgment

5.2 Indicator Calculation Code

# RSI calculation
dataframe['rsi'] = ta.RSI(dataframe)

# Bollinger Bands calculation
bollinger = qtpylib.bollinger_bands(
qtpylib.typical_price(dataframe), # Using typical price
window=20,
stds=1
)
dataframe['bb_lowerband'] = bollinger['lower']
dataframe['bb_middleband'] = bollinger['mid']
dataframe['bb_upperband'] = bollinger['upper']

Typical Price Calculation:

Typical Price = (High + Low + Close) / 3

6. Risk Management Features

6.1 Tight Stoploss Settings

The strategy employs a fixed stoploss of approximately 6.5%, which is relatively tight risk control:

Risk Control TypeParameterDescription
Fixed Stoploss-6.491%Maximum single-trade loss limit
Trailing StoplossEnabledProtects floating profits
Trailing Activation Point+1.036%Activates trailing when profit reaches this value
Trailing Trigger Point+2.409%Triggers stoploss on pullback to this value

6.2 ROI Time Decay

Holding TimeTarget Return
0 minutes40%
335 minutes (~5.6 hours)18.83%
564 minutes (~9.4 hours)7.35%
1097 minutes (~18.3 hours)0% (break-even)

Design Intent: Encourages quick profits in early holding period, reduces return expectations over time, avoids long-term entrapment.

6.3 Order Execution Protection

  • Limit Buy: Ensures execution at expected price, avoids slippage
  • Limit Sell: Controls sell price, avoids significant market deviation
  • Market Stoploss: Prioritizes execution speed in emergencies

7. Strategy Strengths and Limitations

✅ Strengths

  1. Simple Logic: Only 1 buy condition and 1 sell condition, easy to understand and maintain
  2. Classic Combination: Bollinger Bands + RSI is a validated technical analysis combination
  3. Controllable Risk: ~6.5% fixed stoploss + trailing stoploss dual protection
  4. Reasonable Parameters: Uses standard Bollinger Band parameters (20 periods, 1 std dev)
  5. Moderate Timeframe: 1-hour period filters short-term noise, reduces false signals

⚠️ Limitations

  1. Single Condition: Fewer buy signals may miss other opportunities
  2. Extreme Market Risk: RSI filter condition > 7 may miss extreme oversold rebounds
  3. No Trend Filter: Does not judge major trend direction, may enter against the trend
  4. Tight Stoploss: 6.5% stoploss may be triggered by normal volatility
  5. Parameter Optimization Dependency: ROI table parameters are precisely optimized, potential overfitting risk

8. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Range-bound MarketDefault configurationStrategy's original design, suitable for price波动 within channel
Slow Bull MarketIncrease ROI targetsCan appropriately relax sell conditions
Sharp DeclineUse with cautionExtreme oversold may trigger but risk is high
Single-sided TrendNot recommendedStrategy lacks trend direction judgment

9. Applicable Market Environments Explained

BB_RSI is a typical mean reversion strategy. Based on its code architecture and the classic characteristics of the Bollinger Bands + RSI combination, it is best suited for range-bound markets and performs poorly in strong trend markets.

9.1 Strategy Core Logic

  • Mean Reversion: Uses Bollinger Bands to identify price deviation from the mean
  • Oversold Confirmation: RSI filters extreme situations, avoids "catching falling knives"
  • Channel Trading: Buy low, sell high, profit when price returns to channel

9.2 Performance in Different Market Environments

Market TypePerformance RatingReason Analysis
📈 Slow Bull Market⭐⭐⭐☆☆May sell too early, miss subsequent gains
🔄 Range-bound Market⭐⭐⭐⭐⭐Best application scenario, price波动 within channel
📉 Sharp Decline Market⭐⭐☆☆☆Buy signals exist but risk is extremely high
⚡️ Single-sided Trend⭐☆☆☆☆Lacks trend judgment, high risk of counter-trend operations

9.3 Key Configuration Recommendations

Configuration ItemRecommended ValueDescription
StoplossAround -6.5%Current setting is reasonable
Timeframe1hCan adjust based on instrument volatility
Trading PairsModerate volatilityAvoid extremely volatile instruments

10. Important Reminders: The Cost of Complexity

10.1 Learning Curve

Although the strategy logic is simple, understanding the combination of Bollinger Bands and RSI requires some technical analysis foundation. Users are advised to:

  • Understand the mathematical principles of Bollinger Band channels
  • Master the meaning of RSI overbought/oversold
  • Understand the limitations of mean reversion strategies

10.2 Hardware Requirements

Number of Trading PairsMinimum RAMRecommended RAM
1-10 pairs1GB2GB
10-50 pairs2GB4GB

Strategy computational requirements are low.

10.3 Differences Between Backtesting and Live Trading

Common Differences:

  • Backtesting may overestimate signal trigger frequency
  • Live trading slippage affects returns
  • Liquidity risk in extreme market conditions

Recommendations:

  • Evaluate backtest results at 50-70% of reported performance
  • Test live trading with small positions first
  • Monitor performance in extreme market conditions

10.4 Recommendations for Manual Traders

If manually referencing this strategy:

  • Bollinger Band parameters can remain 20 periods, 1 std dev
  • RSI filter condition > 7 can be adjusted based on instrument
  • Set 6.5% stoploss and trailing take-profit after buying

11. Summary

BB_RSI is a classic Bollinger Bands + RSI mean reversion strategy. Its core value lies in:

  1. Simple Logic: Single buy condition, single sell condition, easy to understand and maintain
  2. Classic Combination: Bollinger Bands and RSI are long-validated technical analysis combinations
  3. Controllable Risk: ~6.5% fixed stoploss + trailing stoploss dual protection

For quantitative traders, this is an entry-level strategy suitable for range-bound markets, ideal for learning and understanding the application of Bollinger Bands + RSI combinations. Due to the strategy's single conditions, it is recommended to use it in combination with other filters or trend judgment tools.