BB_RPB_TSL_BIV1 Strategy In-Depth Analysis
Strategy Number: #441 (441st out of 465 strategies) Strategy Type: Multi-condition Bollinger Band Pullback Strategy + Custom Trailing Stop Loss Protection Mechanism Timeframe: 5-minute (5m) + 1-hour information layer (1h)
I. Strategy Overview
BB_RPB_TSL_BIV1 is a multi-condition buy strategy based on Bollinger Band Real Pullback (RPB), combined with a custom trailing stop loss system. The strategy integrates精华 from multiple excellent community strategies, including the trailing stop mechanism from BigZ04_TSL, the pullback logic from TheRealPullbackV2, and the oversold capture approach from NFI series strategies.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 14 independent buy signal groups covering trend, oversold, reversal, and other scenarios |
| Sell Conditions | Multi-layer dynamic take-profit system + custom stop loss logic + signal exit |
| Protection Mechanisms | BTC crash protection, 1h information layer validation, slippage filtering, custom stop loss |
| Timeframe | 5m main framework + 1h information timeframe |
| Dependencies | qtpylib, numpy, talib, pandas_ta, technical.indicators |
II. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.205, # 20.5% target profit
}
# Stop Loss Settings (Base)
stoploss = -0.10 # Fixed stop loss -10% (custom stop loss used in practice)
# Trailing Stop
use_custom_stoploss = True
use_sell_signal = True
Design Philosophy:
- ROI setting is relatively high (20.5%), actually relies on custom stop loss and signal exit
- Fixed stop loss serves only as backup protection, mainly relies on dynamic trailing stop
- Sell signals enabled, strategy has active exit capability
2.2 Custom Stop Loss System
def custom_stoploss(...):
if (current_profit > 0.2):
sl_new = 0.05 # Above 20% profit, lock 5%
elif (current_profit > 0.1):
sl_new = 0.03 # Above 10% profit, lock 3%
elif (current_profit > 0.06):
sl_new = 0.02 # Above 6% profit, lock 2%
elif (current_profit > 0.03):
sl_new = 0.015 # Above 3% profit, lock 1.5%
return sl_new
Tiered Trailing Design:
- Higher profit = tighter stop loss, gradually locking in gains
- Intervention starts at 3% profit, tightening progressively
- High profit区间 (>20%) locks 5%, preventing significant drawdown
III. Buy Conditions Detailed Analysis
3.1 Protection Mechanisms (Multiple Groups)
Each buy condition has independent protection parameter groups, including:
| Protection Type | Parameter Description | Default Value Example |
|---|---|---|
| BTC Protection | BTC crash threshold | buy_btc_safe=-200 |
| 1h Validation | ROC and BB_width validation | buy_roc_1h=4, buy_bb_width_1h=1.074 |
| Slippage Filter | Maximum allowed slippage percentage | max_slip=0.668 |
3.2 14 Buy Conditions Classification
The strategy contains 14 buy condition groups, categorized as follows:
Condition Group 1: Bollinger Band Base Combination (is_BB_checked)
# Combined conditions: dip + break
is_dip = (
(dataframe[f'rmi_length_{...}'] < buy_rmi.value) & # RMI oversold
(dataframe[f'cci_length_{...}'] <= buy_cci.value) & # CCI oversold
(dataframe['srsi_fk'] < buy_srsi_fk.value) # Stochastic RSI oversold
)
is_break = (
(dataframe['bb_delta'] > buy_bb_delta.value) & # BB bandwidth difference
(dataframe['bb_width'] > buy_bb_width.value) & # BB width sufficient
(dataframe['closedelta'] > ...) & # Price change amplitude
(dataframe['close'] < dataframe['bb_lowerband3'] * ...) # Break below 3σ lower band
)
is_BB_checked = is_dip & is_break
Core Logic: Capture entry opportunities when BB lower band breakout coincides with oversold indicator resonance.
Condition Group 2: Local Uptrend (is_local_uptrend)
is_local_uptrend = (
(dataframe['ema_26'] > dataframe['ema_12']) & # EMA trend upward
(dataframe['ema_26'] - dataframe['ema_12'] > ...) & # EMA difference sufficient
(dataframe['close'] < dataframe['bb_lowerband2'] * ...) # Price pulls back to lower band
)
Source: NFI Next Gen strategy approach.
Condition Group 3: Local Dip (is_local_dip)
is_local_dip = (
(dataframe['ema_26'] > dataframe['ema_12']) & # In uptrend
(dataframe['rsi'] < buy_rsi_local_dip.value) & # RSI oversold
(dataframe['crsi'] > buy_crsi_local_dip.value) & # CRSI protection
...
)
Core Logic: Oversold pullback opportunities within an uptrend.
Condition Groups 4-5: EWO Series (is_ewo, is_ewo_2)
is_ewo = (
(dataframe['rsi_fast'] < buy_rsi_fast.value) &
(dataframe['close'] < dataframe['ema_8'] * buy_ema_low.value) &
(dataframe['EWO'] > buy_ewo.value) & # Elliott Wave Oscillator
...
)
Source: SMA Offset strategy, uses EWO to determine trend direction.
Condition Group 6: Reverse Deadfish (is_r_deadfish)
is_r_deadfish = (
(dataframe['ema_100'] < dataframe['ema_200'] * ...) & # Long-term trend weak
(dataframe['bb_width'] > buy_r_deadfish_bb_width.value) &
(dataframe['close'] < dataframe['bb_middleband2'] * ...) &
(dataframe['volume_mean_12'] > ...) & # Volume increase
...
)
Core Logic: Capture rebound opportunities in long-term weak environments.
Condition Group 7: ClucHA (is_clucHA)
is_clucHA = (
(dataframe['rocr_1h'] > buy_clucha_rocr_1h.value) & # 1h ROC validation
(dataframe['bb_delta_cluc'] > ...) & # HA BB difference
(dataframe['ha_close'] < dataframe['bb_lowerband2_40'].shift()) &
...
)
Feature: Combines Heikin Ashi smoothed prices, 40-period BB.
Condition Group 8: Cofi (is_cofi)
is_cofi = (
(dataframe['open'] < dataframe['ema_8'] * buy_ema_cofi.value) &
(qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) & # Stoch cross
(dataframe['adx'] > buy_adx.value) & # ADX strength
(dataframe['EWO'] > buy_ewo_high.value) &
...
)
Core Logic: Stoch fast line golden cross combined with trend strength and EWO.
Condition Groups 9-12: NFI Series
# NFI Quick Mode Series
is_nfi_13 = (...) # 1h EMA trend validation + CTI oversold + EWO extreme
is_nfi_32 = (...) # RSI combination + SMA oversold + CTI extreme
is_nfi_33 = (...) # EMA oversold + EWO high + CTI oversold + Williams %R extreme
is_nfi_38 = (...) # PMAX validation + SMA oversold + EWO negative + CTI extreme
Source: NFI Quick Mode series strategies, capturing extreme oversold opportunities.
Condition Groups 13-15: NFIX Series
is_nfix_5 = (
(dataframe['ema_200_1h'] > ...) & # 1h EMA200 trend upward
(dataframe['close'] < dataframe['sma_75'] * 0.932) & # SMA oversold
...
)
is_nfix_49 = (...) # Delayed 3-period EMA trend + RSI oversold
is_nfix_51 = (...) # Delayed 3-period EMA oversold combination
Feature: Combines 1h information layer and delayed period design, capturing sustained opportunities.
3.3 Buy Conditions Summary
| Condition Group | Condition Number | Core Logic | Backtest Win Rate |
|---|---|---|---|
| BB Combination | 1 | dip + break Bollinger Band oversold resonance | ~90.9% |
| Local Trend | 2 | BB pullback in EMA uptrend | ~92.3% |
| Local Dip | 3 | RSI oversold in uptrend | ~97.8% |
| EWO | 4 | Elliott Wave + RSI oversold | ~86.4% |
| EWO_2 | 5 | 1h EMA200 trend + EWO | ~87% |
| Reverse Deadfish | 6 | Weak rebound opportunities | ~93.9% |
| ClucHA | 7 | Heikin Ashi BB oversold | ~93.4% |
| Cofi | 8 | Stoch golden cross + ADX strength | ~89.1% |
| NFI_13 | 9 | 1h validation + CTI extreme | ~100% |
| NFI_32 | 10 | RSI combination oversold | ~92% |
| NFI_33 | 11 | EWO high + CTI extreme | ~100% |
| NFI_38 | 12 | PMAX + CTI extreme | ~83.2% |
| NFIX_5 | 13 | 1h trend + SMA oversold | ~97.7% |
| NFIX_49 | 14 | Delayed EMA trend combination | ~100% |
| NFIX_51 | 15 | Delayed EMA oversold combination | - |
IV. Sell Logic Detailed Analysis
4.1 Multi-Layer Take-Profit System
The strategy employs tiered take-profit + dynamic trailing mechanism:
Profit Range Stop Loss Threshold Signal Name
─────────────────────────────────────────────────────
>20% Lock 5% custom_stoploss
>10% Lock 3% custom_stoploss
>6% Lock 2% custom_stoploss
>3% Lock 1.5% custom_stoploss
4.2 Custom Sell Signals (custom_sell)
The strategy contains rich custom_sell logic:
Profit Trailing Sell
| Scenario | Trigger Condition | Signal Name |
|---|---|---|
| 0-1.2% profit | Max profit drawdown 4.5% + RSI<46 | sell_profit_t_0_1 |
| 0-1.2% profit | Max profit drawdown 2.5% + RSI<32 | sell_profit_t_0_2 |
| 1.2-2% profit | Max profit drawdown 1% + RSI<39 | sell_profit_t_1_1 |
| 1.2-2% profit | Drawdown 3.5% + RSI<45 + CMF<0 | sell_profit_t_1_2 |
Quick Take-Profit Signals
| Scenario | Trigger Condition | Signal Name |
|---|---|---|
| 2-6% profit | RSI>80 overbought | signal_profit_q_1 |
| 2-6% profit | CTI>0.95 extreme | signal_profit_q_2 |
| 2-6% profit | PMAX conditions | signal_profit_q_pmax_bull/bear |
MOMDIV Signal Exit
if (last_candle['momdiv_sell_1h'] == True) and (current_profit > 0.02):
return 'signal_profit_q_momdiv_1h'
if (last_candle['momdiv_sell'] == True) and (current_profit > 0.02):
return 'signal_profit_q_momdiv'
Stop Loss Signals
| Scenario | Trigger Condition | Signal Name |
|---|---|---|
| Bear market stop loss | Loss>5% + EMA200 deviation + CMF<0 | sell_stoploss_u_e_1 |
| Deadfish stop loss | Loss>5% + BB width small + volume low | sell_stoploss_deadfish |
4.3 Base Sell Signals
# populate_exit_trend
dataframe.loc[(dataframe['volume'] > 0), 'sell'] = 0
# Actual selling relies on custom_sell
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicators | Usage |
|---|---|---|
| Bollinger Bands | BB 20/2σ, BB 20/3σ, BB 40/2σ | Oversold judgment, bandwidth analysis |
| Trend Indicators | EMA 8/12/16/26/50/100/200, SMA 9/15/21/30/75 | Trend judgment, support levels |
| Momentum Indicators | RSI 4/14/20, CCI 26/170, RMI, CRSI | Oversold/overbought judgment |
| Volatility Indicators | CTI (Correlation Trend Indicator), Williams %R 14/32/64/96/480 | Extreme value capture |
| Volume | volume_mean_4/12/24, CMF 20 | Volume validation |
| Special | EWO (Elliott Wave Oscillator), PMAX, MOMDIV | Advanced signals |
5.2 Information Timeframe Indicators (1h)
The strategy uses 1h as an information layer, providing higher-dimensional trend judgment:
- EMA Series: EMA 8/50/100/200, judging long-term trend
- CTI: 1h CTI, assisting oversold degree judgment
- CRSI: Comprehensive RSI indicator
- Williams %R 480: Long-period extreme values
- BB_width: Bollinger Band width validation
- ROC: Rate of change momentum
- MOMDIV: Momentum divergence signal
VI. Risk Management Features
6.1 BTC Protection Mechanism
buy_btc_safe = IntParameter(-300, 50, default=-200)
buy_btc_safe_1d = DecimalParameter(-0.075, -0.025, default=-0.05)
buy_threshold = DecimalParameter(0.003, 0.012, default=0.008)
Protection Logic: When BTC experiences severe crash, pause buying to avoid systemic risk.
6.2 Slippage Filter (confirm_trade_entry)
def confirm_trade_entry(...):
slippage = ((rate / dataframe['close']) - 1) * 100
if slippage < max_slip: # Default 0.668%
return True
else:
return False
Function: Filter high slippage entries, protecting trade quality.
6.3 1h Information Layer Validation
is_additional_check = (
(dataframe['roc_1h'] < buy_roc_1h.value) &
(dataframe['bb_width_1h'] < buy_bb_width_1h.value)
)
All buy signals must pass 1h information layer validation before execution.
VII. Strategy Advantages and Limitations
✅ Advantages
- Multi-condition resonance: 14 buy conditions cover various market scenarios, improving entry precision
- Dynamic stop loss: Tiered trailing stop loss system, balancing profit locking and trend following
- Multi-timeframe: 5m + 1h dual-layer validation, reducing false signal risk
- BTC protection: Systemic risk protection, avoiding entry during major market crashes
- Rich exit logic: Multiple take-profit, stop-loss, signal exit combinations
⚠️ Limitations
- High complexity: 14 buy conditions + multi-layer sell logic, difficult to understand and debug
- Numerous parameters: Large number of Hyperopt parameters, higher overfitting risk
- High computational load: Multiple indicators and 1h information layer require good hardware support
- External indicator dependencies: Uses RMI, zema, etc. from technical.indicators library
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Oscillating decline | Enable all buy conditions | Multi-condition capture of oversold rebound opportunities |
| Moderate trend | Keep EWO, BB combination | Trend pullback entry |
| High volatility | Enable BTC protection | Prevent systemic risk |
| Low volatility | Lower BB_width threshold | More sensitive oversold capture |
IX. Applicable Market Environment Detailed Analysis
BB_RPB_TSL_BIV1 is an enhanced version of the BB_RPB_TSL series. Based on its code architecture and long-term live trading verification experience from the community, it is most suitable for oscillating decline markets, while performing poorly in strong uptrend markets.
9.1 Strategy Core Logic
- Oversold capture as core: Most buy conditions based on oversold indicator (RSI, CTI, Williams %R) resonance
- Pullback entry approach: Wait for price to pull back to Bollinger Band lower band during uptrend
- Multi-layer validation mechanism: 1h information layer, BTC protection, slippage filter build multi-layer safety net
- Dynamic exit design: Profit trailing, signal exit, stop loss triple exit mechanism
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Strong uptrend | ⭐⭐☆☆☆ | Strategy designed to capture pullbacks, few pullback opportunities in strong trends, may miss main rally |
| 🔄 Oscillating decline | ⭐⭐⭐⭐⭐ | Oversold capture mechanism perfectly matches, multi-layer validation improves precision |
| 📉 Continuous crash | ⭐⭐☆☆☆ | BTC protection pauses buying, but existing positions may suffer losses |
| ⚡️ High volatility oscillation | ⭐⭐⭐☆☆ | Multi-conditions can capture volatility opportunities, but fee loss is significant |
9.3 Key Configuration Recommendations
| Configuration Item | Suggested Value | Description |
|---|---|---|
| max_slip | 0.5-0.8 | Appropriately relax slippage limits in high volatility markets |
| buy_bb_width | 0.08-0.12 | Adjust Bollinger Band width sensitivity |
| BTC protection threshold | Adjust according to market | Tighten threshold in high-risk markets |
X. Important Reminder: The Cost of Complexity
10.1 Learning Cost
The strategy contains 14 buy condition groups, multi-layer sell logic, custom stop loss system, BTC protection mechanism, slippage filter, 1h information layer validation. Full understanding requires:
- Bollinger Band theoretical foundation
- Elliott Wave Oscillator principles
- CTI, Williams %R and other indicator meanings
- PMAX, MOMDIV advanced indicators
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| 10-20 pairs | 4GB | 8GB |
| 50+ pairs | 8GB | 16GB |
10.3 Differences Between Backtest and Live Trading
- Overfitting risk: Large number of Hyperopt parameters may lead to "perfect" backtest but ineffective live trading
- BTC protection impact: Live trading BTC crash protection reduces entry opportunities
- Slippage differences: Live trading slippage may exceed expectations
10.4 Manual Trader Recommendations
Not recommended for manual traders to directly imitate this strategy logic:
- Condition combinations too complex
- Requires real-time monitoring of multiple indicators
- Exit timing judgment difficulty is high
XI. Summary
BB_RPB_TSL_BIV1 is a multi-condition oversold capture strategy, with core value in:
- Multi-layer validation system: From BTC protection, 1h information layer to slippage filter, building safe entry mechanism
- Rich buy scenario coverage: 14 condition groups cover trend pullback, oversold rebound, extreme reversal and other opportunities
- Dynamic exit design: Tiered trailing stop loss + multi-signal exit, flexibly handling different profit ranges
For quantitative traders, this strategy is suitable as a main strategy in oscillating markets, but attention should be paid to overfitting risk in parameter tuning. It is recommended to conduct sufficient backtest verification first, then test with small positions in live trading.