BB_RPB_TSLmeneguzzo Strategy In-Depth Analysis
Strategy Number: #452 (452nd out of 465 strategies) Strategy Type: Multi-dimensional Oversold Buy + Tiered Dynamic Profit-Taking Stop Loss Timeframe: 5 minutes (5m) + 1-hour information layer (1h)
I. Strategy Overview
BB_RPB_TSLmeneguzzo is an enhanced version of the BB_RPB_TSL series, adding more buy signal types and complex custom_sell dynamic profit-taking mechanisms on top of the original Bollinger Bands breakout logic. The strategy integrates buy logic from multiple classic strategies including ClucHA, Gumbo, SqzMom, NFI, forming a multi-dimensional entry system.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 11 independent buy signal groups, covering various oversold scenarios |
| Sell Conditions | custom_sell dynamic profit-taking (over 15 exit logics) + custom_stoploss tiered stop loss |
| Protection Mechanism | Slippage protection (max_slip), 1-hour trend check |
| Timeframe | Main 5m + Information 1h (EMA/CTI/CMF/Ichimoku) |
| Dependencies | qtpylib, talib, pandas_ta, technical.indicators |
| Special Mechanism | PMAX profit maximization indicator, MOMDIV momentum divergence, T3 average |
II. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI Exit Table (Tiered Profit-Taking)
minimal_roi = {
"0": 0.205, # Immediately reach 20.5% profit target
"81": 0.038, # 3.8% profit target after 81 minutes
"292": 0.005, # 0.5% profit target after 292 minutes
}
# Base stop loss setting
stoploss = -0.10 # 10% hard stop loss (bottom line)
# Custom stop loss enabled
use_custom_stoploss = True
use_sell_signal = True
# Slippage protection
max_slip = 0.983 # Maximum allowed slippage 0.983%
Design Philosophy:
- ROI divided into three tiers: high profit target (20.5%) → medium profit target (3.8%) → low profit target (0.5%)
- Tiered ROI配合 custom_sell achieves multi-level profit-taking
- max_slip parameter prevents entry in high slippage environments
2.2 Custom Stop Loss Mechanism
def custom_stoploss(...):
if current_profit > 0.2: # Profit > 20%
sl_new = 0.05 # Stop loss tightens to 5%
elif current_profit > 0.1: # Profit > 10%
sl_new = 0.03 # Stop loss tightens to 3%
elif current_profit > 0.06:# Profit > 6%
sl_new = 0.02 # Stop loss tightens to 2%
elif current_profit > 0.03:# Profit > 3%
sl_new = 0.015 # Stop loss tightens to 1.5%
return sl_new
Stop Loss Logic: Higher profit, tighter stop loss (step-wise tightening)
III. Buy Conditions Detailed Explanation
3.1 1-Hour Trend Check Mechanism
Strategy performs trend confirmation through 1-hour information layer:
| Check Type | Parameter Description | Default Value |
|---|---|---|
| ROC Check | buy_roc_1h: 1-hour ROC upper limit | 86 |
| BB Width Check | buy_bb_width_1h: 1-hour Bollinger Bands width upper limit | 0.954 |
Logic: 1-hour ROC not exceeding threshold, BB Width not exceeding threshold, avoids entry in extreme volatility environments
3.2 11 Buy Conditions Detailed Explanation
Condition #1: BB Joint Signal (is_BB_checked)
Combined Logic: is_dip (oversold check) + is_break (breakout check)
# is_dip: Oversold state detection
- rmi_length < 49 (RMI oversold)
- cci_length <= -116 (CCI oversold)
- srsi_fk < 32 (SRSI oversold)
# is_break: Bollinger Bands breakout detection
- bb_delta > 0.025
- bb_width > 0.095
- closedelta > close * 0.018
- close < bb_lowerband3 * 0.999
Condition #2: Local Uptrend (is_local_uptrend)
# NFI Next Gen logic
- ema_26 > ema_12
- ema_26 - ema_12 > open * 0.026
- close < bb_lowerband2 * 0.995
- closedelta > close * 0.018
Condition #3: EWO Signal (is_ewo)
# SMA offset logic
- rsi_fast < 44
- close < ema_8 * 0.935
- EWO > -5.001
- close < ema_16 * 0.968
- rsi < 23
Condition #4: Reverse Deadfish (is_r_deadfish)
# Reverse Deadfish logic — find rebound opportunities in downtrend
- ema_100 < ema_200 * 1.054 (EMA 100 far below EMA 200)
- bb_width > 0.299 (Bollinger Bands width sufficiently wide)
- close < bb_middleband2 * 1.014 (Price below Bollinger Bands middle rail)
- volume_mean_12 > volume_mean_24 * 1.59 (Volume increases)
- cti < -0.115 (CTI oversold)
- r_14 < -44.34 (Williams %R oversold)
Condition #5: SqzMom Squeeze Momentum (is_sqzmom)
# Squeeze Momentum logic — LazyBear's classic strategy
- bb_lowerband2 < kc_lowerband_28_1 (Bollinger Bands lower band below KC lower band)
- bb_upperband2 > kc_upperband_28_1 (Bollinger Bands upper band above KC upper band)
- linreg_val_20.shift(2) > linreg_val_20.shift(1) (Linear regression declining)
- linreg_val_20.shift(1) < linreg_val_20 (Linear regression rebounds)
- linreg_val_20 < 0 (Linear regression value negative)
- close < ema_13 * 0.981
- EWO < -3.966
- r_14 < -45.068
Condition #6: NFI 13 Signal (is_nfi_13)
# NFI high precision mode
- ema_50_1h > ema_100_1h (1-hour EMA 50 > EMA 100)
- close < sma_30 * 0.99
- cti < -0.92
- EWO < -5.585
- cti_1h < -0.88
- crsi_1h > 10.0
Condition #7: NFI 32 Signal (is_nfi_32)
# NFI fast mode (NFIX 26)
- rsi_slow < rsi_slow.shift
- rsi_fast < 46
- rsi > 25.0
- close < sma_15 * 0.93
- cti < -0.9
Condition #8: NFI 33 Signal (is_nfi_33)
# NFI precision mode
- close < ema_13 * 0.978
- EWO > 8
- cti < -0.88
- rsi < 32
- r_14 < -98.0
- volume < volume_mean_4 * 2.5
Condition #9: NFIX 49 Signal (is_nfix_49)
# NFIX advanced mode
- ema_26.shift(3) > ema_12.shift(3)
- ema_26.shift(3) - ema_12.shift(3) > open.shift(3) * 0.032
- close.shift(3) < ema_20.shift(3) * 0.916
- rsi.shift(3) < 32.5
- crsi.shift(3) > 18.0
- cti < -0.105
- r_14 < -81.827
Condition #10: NFI7 33 Signal (is_nfi7_33)
# NFI7 mode — with moderi trend confirmation
- moderi_96 (96-period Modified Elder Ray Index trend upward)
- cti < -0.88
- close < ema_13 * 0.988
- EWO > 6.4
- rsi < 32.0
- volume < volume_mean_4 * 2.0
Condition #11: NFI7 37 Signal (is_nfi7_37)
# NFI7 + PMAX mode
- pm > pmax_thresh (PMAX indicator above threshold)
- close < sma_75 * 0.98
- EWO > 9.8
- rsi < 56.0
- cti < -0.7
- safe_dump_50_1h (1-hour safety crash check)
3.3 Buy Conditions Classification Summary
| Condition Group | Condition Numbers | Core Logic | Hyperopt Status |
|---|---|---|---|
| Oversold Rebound | #1 BB_checked | RMI/CCI/SRSI oversold + BB breakout | Disabled |
| Trend Pullback | #2 local_uptrend | EMA moving average trend + BB pullback | Disabled |
| EWO Wave | #3 ewo | Elliott Wave Oscillator | Disabled |
| Reverse Deadfish | #4 r_deadfish | Rebound opportunities in downtrend | Disabled |
| Squeeze Momentum | #5 sqzmom | Squeeze Momentum breakout | Disabled |
| NFI Series | #6-11 nfi series | Various NFI oversold patterns | Partially enabled |
IV. Sell Logic Detailed Explanation
4.1 custom_sell Dynamic Profit-Taking System
Strategy uses complex custom_sell function implementing over 15 exit logics:
4.1.1 Profit Trailing Profit-Taking (sell_profit_t series)
# Profit 0% ~ 1.2% range
if 0.012 > current_profit >= 0.0:
if max_profit > current_profit + 0.045 and rsi < 46.0:
return "sell_profit_t_0_1"
if max_profit > current_profit + 0.025 and rsi < 32.0:
return "sell_profit_t_0_2"
...
# Profit 1.2% ~ 2% range
elif 0.02 > current_profit >= 0.012:
if max_profit > current_profit + 0.01 and rsi < 39.0:
return "sell_profit_t_1_1"
...
Logic: When current profit drawdown exceeds threshold, triggers exit if RSI and other indicators confirm
4.1.2 MOMDIV Momentum Divergence Profit-Taking (signal_profit_q_momdiv)
# When profit > 2%, check MOMDIV
if current_profit > 0.02:
if momdiv_sell_1h == True:
return "signal_profit_q_momdiv_1h"
if momdiv_sell == True:
return "signal_profit_q_momdiv"
if momdiv_coh == True:
return "signal_profit_q_momdiv_coh"
Logic: Triggers sell when momentum indicator breaks through Bollinger Bands upper/lower rails
4.1.3 Fast Profit-Taking (signal_profit_q series)
# RSI extreme high value
if 0.06 > current_profit > 0.02 and rsi > 80.0:
return "signal_profit_q_1"
# CTI extreme high value
if 0.06 > current_profit > 0.02 and cti > 0.95:
return "signal_profit_q_2"
# PMAX breakout
if pm <= pmax_thresh and close > sma_21 * 1.1:
return "signal_profit_q_pmax_bull"
4.1.4 Bear Market Profit-Taking (sell_profit_u_bear)
# Profit-taking when price below EMA 200
if close < ema_200:
if 0.02 > current_profit >= 0.01:
if rsi < 34.0 and cmf < 0.0:
return "sell_profit_u_bear_1_1"
...
4.1.5 Stop Loss Exit (sell_stoploss)
# Base stop loss exit
if current_profit < -0.05:
if close < ema_200 * 0.988 and cmf < -0.046:
...
return "sell_stoploss_u_e_1"
# Deadfish stop loss
if current_profit < -0.063:
if close < ema_200 and bb_width < 0.043:
...
return "sell_stoploss_deadfish"
4.2 Profit-Taking Logic Summary Table
| Profit Range | Exit Signal Type | Trigger Conditions |
|---|---|---|
| 0% ~ 1.2% | sell_profit_t_0_* | Profit drawdown + RSI confirmation |
| 1.2% ~ 2% | sell_profit_t_1_* | Profit drawdown + RSI/CMF confirmation |
| > 2% | signal_profit_q_momdiv | MOMDIV momentum divergence |
| > 2% | signal_profit_q_* | RSI/CTI/PMAX extreme values |
| < 0% | sell_stoploss_* | Stop loss exit |
V. Technical Indicator System
5.1 Core Indicators (5-minute timeframe)
| Indicator Category | Specific Indicators | Usage |
|---|---|---|
| Bollinger Bands | BB(20,2), BB(20,3), BB(40,2) | Breakout and pullback detection |
| Momentum Indicators | RMI, CCI, SRSI, CRSI | Oversold state judgment |
| Moving Average System | EMA 4/8/12/13/16/20/26/50/100/200 | Trend judgment |
| Oscillator Indicators | RSI(4/14/20), Williams %R(14/32/64/96/480) | Overbought/oversold judgment |
| Volume Indicators | CMF, volume_mean_4/12/24 | Capital flow judgment |
| EWO | EWO(50,200) | Elliott Wave Oscillator |
| CTI | CTI(20) | Correlation Trend Indicator |
| PMAX | PMAX(9,27,10) | Profit maximization indicator |
| T3 Average | T3(5) | T3 average line |
| Keltner Channel | KC(28,1), KC(20,2) | Squeeze momentum judgment |
| Linear Regression | LINEARREG(20) | Linear regression trend |
5.2 Information Timeframe Indicators (1-hour)
Strategy uses 1-hour as information layer:
- EMA System: EMA 8/50/100/200
- CTI: CTI(20), CTI(40)
- CRSI: Composite RSI (3,2,100)
- Williams %R: R(96), R(480)
- Bollinger Bands: BB(20,2)
- ROC: ROC(9)
- MOMDIV: Momentum divergence indicator
- CMF: Chaikin Money Flow
- Heikin Ashi: Smooth candlestick chart
- ROCR: ROC Rate (168 periods)
- T3 Average: T3 average line
- EWO: Elliott Wave Oscillator
- Safety Crash Check: safe_dump_50
5.3 Special Indicators Detailed Explanation
PMAX (Profit Maximization Indicator)
def pmax(df, period=10, multiplier=27, length=9, MAtype=1, src=3):
# Dynamic support/resistance line based on ATR and EMA
# MAtype=1 → EMA
# src=3 → (high+low+close+open)/4
MOMDIV (Momentum Divergence)
def momdiv(df, mom_length=10, bb_length=20, bb_dev=2.0, lookback=30):
# Momentum indicator MOM Bollinger Bands breakout
# mom > upperband → sell signal
# mom < lowerband → buy signal
VI. Risk Management Features
6.1 Slippage Protection Mechanism
def confirm_trade_entry(...):
max_slip = 0.983 # Maximum allowed slippage
slippage = ((rate / close) - 1) * 100
if slippage < max_slip:
return True # Allow entry
else:
return False # Reject entry
Logic: When buy price deviates from closing price by more than 0.983%, rejects entry
6.2 Tiered Stop Loss Mechanism
| Profit Range | Stop Loss Value | Description |
|---|---|---|
| > 20% | 5% | Strict protection at high profit |
| > 10% | 3% | Moderate protection at medium profit |
| > 6% | 2% | Initial profit protection |
| > 3% | 1.5% | Small profit protection |
6.3 1-Hour Trend Check
is_additional_check = (
(dataframe['roc_1h'] < self.buy_roc_1h.value) &
(dataframe['bb_width_1h'] < self.buy_bb_width_1h.value)
)
Logic: Avoids entry when 1-hour ROC is extremely high or Bollinger Bands extremely wide
6.4 Hyperopt Parameter Optimization
| Parameter Group | Optimization Status | Parameter Count |
|---|---|---|
| dip oversold | Disabled | 5 |
| break breakout | Disabled | 2 |
| local_uptrend | Disabled | 3 |
| ewo | Disabled | 5 |
| r_deadfish | Disabled | 6 |
| sqzmom | Disabled | 3 |
| nfix_49 | Disabled | 2 |
| slip | Disabled | 1 |
| sell_stoploss | Disabled | 3 |
| deadfish | Disabled | 4 |
| cti_r | Disabled | 2 |
VII. Strategy Advantages and Limitations
✅ Advantages
- Diversified buy signals: 11 buy conditions covering oversold, reverse deadfish, squeeze momentum and other scenarios
- Tiered profit-taking stop loss: Over 15 exit logics, refined control
- Slippage protection: confirm_trade_entry prevents high slippage entry
- Rich special indicators: PMAX, MOMDIV, T3, CTI and other advanced indicators
- 1-hour information layer confirmation: Provides multi-dimensional trend judgment
⚠️ Limitations
- Extremely complex: 11 buy conditions, over 15 sell logics, high understanding difficulty
- Numerous parameters: Over 40 Hyperopt parameters, extremely high optimization difficulty
- Computationally intensive: Large number of indicator calculations, high hardware requirements
- Sell signals rely on custom_sell: populate_exit_trend basically doesn't work, exit全靠 custom_sell
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Sideways market | Enable BB_checked + sqzmom | Oversold rebound effective |
| Downtrend | Enable r_deadfish | Reverse Deadfish logic |
| Trend pullback | Enable local_uptrend + nfi series | Diverse NFI signals |
| High volatility | Enable slippage protection | max_slip prevents high slippage entry |
IX. Applicable Market Environment Detailed Explanation
BB_RPB_TSLmeneguzzo is the "super enhanced version" of the BB_RPB_TSL series. Based on its code architecture, it is most suitable for multi-pattern sideways markets, capable of identifying various types of oversold opportunities.
9.1 Strategy Core Logic
- Multi-dimensional oversold detection: Through RMI/CCI/CTI/Williams %R and other oversold indicator combinations
- Squeeze Momentum breakout: Squeeze Momentum logic identifies breakout after energy accumulation
- Reverse Deadfish: Find rebound opportunities in downtrend
- Tiered dynamic profit-taking: Intelligent exit during profit drawdown
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Slow bull rise | ⭐⭐⭐⭐⭐ | Multiple buy signals can trigger, refined profit-taking logic |
| 🔄 Sideways consolidation | ⭐⭐⭐⭐⭐ | Oversold rebound + squeeze momentum breakout both effective |
| 📉 Continuous decline | ⭐⭐⭐☆☆ | Reverse Deadfish logic may trigger, but higher risk |
| ⚡️ High volatility | ⭐⭐⭐☆☆ | Slippage protection activates, but stop loss may trigger frequently |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| max_slip | 0.983 | Slippage protection threshold, adjustable based on market |
| custom_sell | All enabled | All exit logics enabled |
| Hyperopt time | > 1000 epochs | Extremely numerous parameters, need large optimization time |
X. Important Reminder: The Cost of Complexity
10.1 Learning Cost
Strategy integrates BB, SqzMom, NFI, PMAX, MOMDIV and other technical systems, beginners need to understand:
- Squeeze Momentum squeeze breakout logic
- PMAX profit maximization indicator working principle
- MOMDIV momentum divergence meaning
- Reverse Deadfish entry logic
- custom_sell tiered profit-taking mechanism
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum Memory | Recommended Memory |
|---|---|---|
| < 10 pairs | 4 GB | 8 GB |
| 10 ~ 30 pairs | 8 GB | 16 GB |
| > 30 pairs | 16 GB | 32 GB |
10.3 Differences Between Backtesting and Live Trading
custom_sell relies on real-time data for profit drawdown calculation, may have deviations in backtesting. Recommendations:
- Use Dry-run mode to test custom_sell effect
- Observe whether profit-taking triggers correctly during profit drawdown
10.4 Manual Trader Recommendations
Strongly not recommended to execute this strategy manually:
- 11 buy condition judgments are complex
- custom_sell relies on real-time profit calculation
- PMAX, MOMDIV and other indicators require real-time calculation
XI. Summary
BB_RPB_TSLmeneguzzo is an extremely complex multi-dimensional quantitative strategy. Its core value lies in:
- Entry diversity: 11 buy conditions covering oversold, squeeze momentum, reverse deadfish and other scenarios
- Refined exit: Over 15 exit logics, intelligent profit-taking during profit drawdown
- Advanced indicators: PMAX, MOMDIV, T3, CTI and other professional indicators
- Slippage protection: confirm_trade_entry prevents high slippage entry
For quantitative traders, this is a strategy suitable for advanced players, requiring full understanding of various technical indicators and custom_sell mechanism, and significant time investment for Hyperopt optimization.