STRATEGY_RSI_BB_BOUNDS_CROSS Strategy Deep Analysis
Strategy ID: #369 (369th of 465 strategies)
Strategy Type: RSI-Bollinger Band Boundary Crossover + Trend Confirmation
Timeframe: 5 minutes (5m)
I. Strategy Overview
STRATEGY_RSI_BB_BOUNDS_CROSS is a quantitative strategy based on dynamic crossovers between RSI and Bollinger Band boundaries. The core innovation of this strategy is converting RSI overbought/oversold levels (70/30) into price coordinates, forming dynamic "RSI price boundaries," then comparing them with Bollinger Band upper and lower bands to capture changes in price relative position across two different indicator systems.
Core Features
| Feature | Description |
|---|---|
| Buy Condition | 1 buy signal, based on the crossover relationship between Bollinger Band lower band and RSI lower boundary |
| Sell Condition | 1 basic sell signal, based on short-term EMA direction judgment |
| Protection Mechanism | No built-in protection parameter group |
| Timeframe | 5m main timeframe |
| Dependencies | talib, qtpylib, numpy, pandas |
| Author | Fractate_Dev |
II. Strategy Configuration Analysis
2.1 Basic Risk Parameters
# ROI Exit Table
minimal_roi = {
"60": 0.01, # 1% profit required after 60 minutes
"30": 0.02, # 2% profit required after 30 minutes
"0": 0.04 # 4% profit required immediately
}
# Stop Loss Setting
stoploss = -0.10 # 10% stop loss
# Trailing Stop
trailing_stop = False # Not enabled
Design Rationale:
- ROI uses a progressive design - the longer the holding period, the lower the take-profit threshold
- 10% stop loss is relatively loose, giving price enough room for fluctuation
- No trailing stop enabled, relying on fixed ROI and signal exits
2.2 Order Type Configuration
order_types = {
'buy': 'limit', # Limit buy
'sell': 'limit', # Limit sell
'stoploss': 'market', # Market stop loss
'stoploss_on_exchange': False
}
order_time_in_force = {
'buy': 'gtc', # Good Till Cancelled
'sell': 'gtc'
}
III. Buy Condition Details
3.1 Core Innovation: RSI Price Boundary Calculation
The core innovation of this strategy is converting RSI overbought/oversold levels into actual price coordinates:
# RSI Upper Boundary (price corresponding to overbought level 70)
ep = 2 * length - 1 # EMA smoothing period
x1 = (length - 1) * (adc * 70 / (100-70) - auc)
rsi_ub = close + x1 (when x1 >= 0) or close + x1 * (100-70)/70 (when x1 < 0)
# RSI Lower Boundary (price corresponding to oversold level 30)
x2 = (length - 1) * (adc * 30 / (100-30) - auc)
rsi_lb = close + x2 (when x2 >= 0) or close + x2 * (100-30)/30 (when x2 < 0)
Principle Explanation:
auc: Upward momentum (EMA of price increases)adc: Downward momentum (EMA of price decreases)- Through momentum ratio conversion, RSI's 70/30 levels are mapped to actual prices
3.2 Buy Condition: Bollinger Band Lower Band Crossing RSI Lower Boundary
dataframe.loc[
(
# Trend confirmation: Bollinger Band lower band below RSI lower boundary for 14 consecutive candles
(dataframe['lb_bb_under_rsi_trend']) &
# Bollinger Band lower band continuously below RSI lower boundary
(dataframe['bb_lb'] < dataframe['rsi_lb']) &
(dataframe['bb_lb'].shift(1) < dataframe['rsi_lb'].shift(1)) &
# EMA2 rising (short-term momentum upward)
(dataframe['ema2'] > dataframe['ema2'].shift(1))
),
'buy'] = 1
Condition Breakdown:
| Condition | Description | Logical Purpose |
|---|---|---|
lb_bb_under_rsi_trend | Bollinger Band lower band below RSI lower boundary for 14 consecutive candles | Trend persistence confirmation |
bb_lb < rsi_lb | Current Bollinger Band lower band below RSI lower boundary | Price at relatively low position |
bb_lb.shift(1) < rsi_lb.shift(1) | Previous candle's Bollinger Band lower band also below RSI lower boundary | Stability confirmation |
ema2 > ema2.shift(1) | 2-period EMA rising | Short-term momentum confirmation |
3.3 Trend Confirmation Mechanism
The strategy uses _trend_length = 14 as the trend confirmation period:
for i in range(_trend_length):
dataframe['ub_bb_over_rsi_trend'] = dataframe['ub_bb_over_rsi'].shift(i) & dataframe['ub_bb_over_rsi_trend']
dataframe['lb_bb_under_rsi_trend'] = dataframe['lb_bb_under_rsi'].shift(i) & dataframe['lb_bb_under_rsi_trend']
IV. Sell Logic Details
4.1 Sell Signal: EMA2 Decline
dataframe.loc[
(
# EMA2 declining (short-term momentum downward)
(dataframe['ema2'] < dataframe['ema2'].shift(1))
),
'sell'] = 1
Design Rationale:
- The sell signal is very concise, relying only on the 2-period EMA direction change
- This design emphasizes "fast in, fast out," being highly sensitive to momentum changes
- Contrasts with the complexity of buy conditions; selling is more decisive
4.2 ROI Take-Profit Mechanism
| Holding Time | Target Return | Description |
|---|---|---|
| Immediately | 4% | Seek 4% profit opportunity immediately after entry |
| 30 minutes | 2% | Lower take-profit target after 30 minutes |
| 60 minutes | 1% | Further lower target after 60 minutes |
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Parameters | Purpose |
|---|---|---|---|
| Volatility | Bollinger Bands | Window 14, StdDev 2 | Price relative position judgment |
| Momentum | RSI | Period 14 | Overbought/oversold judgment |
| Trend | EMA | Periods 14, 2 | Direction confirmation |
| Custom | RSI Price Boundaries | Period 14 | Dynamic support/resistance |
5.2 Bollinger Band Smoothing
The strategy applies additional smoothing to the Bollinger Band lower band:
_bb_smooth_length = 4
dataframe['bb_lb_smoothed'] = 0
for i in range(_bb_smooth_length):
dataframe['bb_lb_smoothed'] += dataframe['bb_lb'].shift(i) / _bb_smooth_length
Purpose: Reduce noise in the Bollinger Band lower band, providing a more stable reference
5.3 Visualization Configuration
plot_config = {
'main_plot': {
'bb_ub': {'color': 'green'}, # Bollinger Band upper band
'bb_lb': {'color': 'green'}, # Bollinger Band lower band
'bb_lb_smoothed': {'color': 'red'}, # Smoothed Bollinger Band lower band
'rsi_ub': {'color': 'black'}, # RSI upper boundary
'rsi_lb': {'color': 'black'}, # RSI lower boundary
'rsi_lb_smoothed': {'color': 'orange'}, # Smoothed RSI lower boundary
},
'subplots': {
"bb_rsi_count": {
'ub_bb_over_rsi_trend': {}, # Upper band trend
'lb_bb_under_rsi_trend': {}, # Lower band trend
},
}
}
VI. Risk Management Features
6.1 Dual Boundary Confirmation Mechanism
The strategy uses two independent boundary systems for cross-verification:
- Bollinger Band Boundaries: Statistical boundaries based on price volatility
- RSI Price Boundaries: Dynamic boundaries based on momentum
Signals are triggered only when both systems align, reducing false signal risk.
6.2 Trend Persistence Filter
The 14-period trend confirmation ensures:
- Not a single candle's noise signal
- Price is genuinely in a sustained relatively low position
- Avoids frequent trading during oscillation
6.3 Short-Period Momentum Confirmation
2-period EMA as entry confirmation:
- Wait for short-term momentum to turn
- Avoid premature entry during decline
VII. Strategy Advantages and Limitations
✅ Advantages
- Innovative Dual Boundary System: Mapping RSI levels to price coordinates creates unique support/resistance judgment
- Trend Persistence Filter: 14-period trend confirmation effectively reduces false signals
- Concise Exit Mechanism: Selling doesn't drag on, responding quickly to momentum changes
- Smoothing Reduces Noise: Smoothing applied to key indicators improves signal quality
⚠️ Limitations
- Oversimplified Sell Signal: Relying only on EMA2 direction change may overreact during sharp fluctuations
- No Trailing Stop: Missing opportunities to lock in floating profits
- Relatively Strict Buy Conditions: Multiple conditions need to be met simultaneously, possibly missing some opportunities
- Hardcoded Parameters: Key parameters like
_trend_length=14are hardcoded, lacking optimization flexibility
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Oscillating Uptrend | Default configuration | Strategy's design intent, capturing pullback buy opportunities |
| High Volatility | Adjust stop loss | May need tighter stop loss to control risk |
| One-way Uptrend | Use with caution | Sell signal may trigger too early |
| One-way Downtrend | Not recommended | Buy signals may trigger frequently but result in being trapped |
IX. Applicable Market Environment Details
STRATEGY_RSI_BB_BOUNDS_CROSS is an innovative boundary crossover strategy. Based on its code architecture and logic design, it is best suited for oscillating uptrend or sideways oscillation markets, while performance may be suboptimal in one-way trend markets.
9.1 Strategy Core Logic
- Dual Boundary System: Simultaneously using Bollinger Bands and RSI price boundaries for unique cross-verification
- Trend Confirmation: 14-period persistence confirmation ensures signal reliability
- Momentum Confirmation: 2-period EMA direction confirms entry timing
9.2 Performance in Different Market Environments
| Market Type | Rating | Analysis |
|---|---|---|
| 📈 Slow Bull Uptrend | ⭐⭐⭐⭐☆ | Pullback buy mechanism effective, but selling may be premature |
| 🔄 Sideways Oscillation | ⭐⭐⭐⭐⭐ | Dual boundary system performs excellently in oscillation |
| 📉 One-way Downtrend | ⭐⭐☆☆☆ | Buy signals may trigger but frequent stop losses |
| ⚡ High Volatility | ⭐⭐⭐☆☆ | EMA2 may frequently trigger buy/sell signals |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| Timeframe | 5m | Default design, suitable for intraday trading |
| Stop Loss | -0.10 | Loose stop loss, giving room for fluctuation |
| Startup Period | 20 | Need sufficient data for indicator calculation |
X. Important Note: The Cost of Complexity
10.1 Learning Cost
The strategy uses innovative RSI price boundary calculation methods, requiring understanding of:
- RSI momentum conversion principles
- Bollinger Band and RSI boundary crossover logic
- Role of trend confirmation mechanism
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| 1-10 | 2GB | 4GB |
| 10-50 | 4GB | 8GB |
Strategy calculation is moderate, modern VPS can easily run it.
10.3 Differences Between Backtesting and Live Trading
- Trend confirmation appears stable in backtesting, but signal delays may occur in live trading
- EMA2 is sensitive to real-time data, which may lead to slippage impact
10.4 Suggestions for Manual Traders
If trading manually, focus on:
- The relationship between Bollinger Band lower band and RSI lower boundary
- 14 consecutive candles trend confirmation
- 2-period EMA direction change
XI. Summary
STRATEGY_RSI_BB_BOUNDS_CROSS is an innovative boundary crossover strategy. Its core value lies in:
- Unique Price Boundary System: Mapping RSI levels to price coordinates, forming dynamic support/resistance
- Strict Trend Confirmation: 14-period persistence filter ensures signal quality
- Concise Execution Logic: Complex buy confirmation, simple and decisive selling
For quantitative traders, this strategy provides a unique perspective to understand the relationship between RSI and Bollinger Bands, worth testing and verifying in oscillating markets. However, note that the simplicity of the sell signal may lead to premature exits in certain market conditions.