Skip to main content

BB_RPB_TSL_2 Strategy In-Depth Analysis

Strategy ID: #439 (439th of 465 strategies)
Strategy Type: Multi-Condition Bollinger Band Breakout + Tiered Trailing Stop Loss System
Timeframes: 3 minutes (3m) + Info frame 5m + 1h


I. Strategy Overview

BB_RPB_TSL_2 is a multi-condition quantitative strategy based on Bollinger Band breakouts, incorporating Real Pull Back (RPB) pullback identification logic and a custom tiered trailing stop loss system. The strategy captures various market patterns through 28 independent buy signals, combined with dynamic take-profit and stop-loss mechanisms for risk control.

Core Features

FeatureDescription
Buy Conditions28 independent buy signals (14 on 3m frame + 14 mirrored on 5m frame), can trigger independently
Sell Conditions20+ base sell signals + tiered dynamic take-profit logic
Protection MechanismsCustom tiered trailing stop loss + slippage confirmation + Dead Fish stop loss
TimeframesMain frame 3m + Info frames 5m + 1h
Dependenciestalib, pandas_ta, qtpylib, technical.indicators

II. Strategy Configuration Analysis

2.1 Basic Risk Parameters

# ROI Exit Table
minimal_roi = {
"0": 0.205, # 20.5% target profit
}

# Stop Loss Setting
stoploss = -0.15 # 15% fixed stop loss (backup)

# Trailing Stop Loss
use_custom_stoploss = True # Enable custom stop loss

Design Rationale:

  • ROI set at 20.5%, providing ample profit room
  • Fixed stop loss at -15% as a safety net, primarily controlling risk through custom stop loss
  • Custom stop loss uses tiered trailing mechanism - the more profit, the tighter the protection

2.2 Order Type Configuration

The strategy uses standard order types by default, with slippage verification through the confirm_trade_entry function.

# Slippage Control
max_slip = DecimalParameter(0.33, 0.80, default=0.33)

III. Buy Conditions Detailed Analysis

3.1 Global Protection Mechanisms (2 Groups)

All buy signals must pass additional checks:

Protection TypeParameter DescriptionDefault Value
ROC_1h1-hour rate of change limit< 86 (hyperopt)
BB_width_1h1-hour Bollinger Band width limit< 0.954 (hyperopt)
is_additional_check = (
(dataframe['roc_1h'] < self.buy_roc_1h.value) &
(dataframe['bb_width_1h'] < self.buy_bb_width_1h.value)
)

3.2 Buy Condition Categories

Condition Group 1: Bollinger Band Breakout (4 conditions)

#1 BB_checked (Dip + Break Combination)

# Dip Conditions
(dataframe['rmi_length'] < 49) &
(dataframe['cci_length'] <= -116) &
(dataframe['srsi_fk'] < 32)

# Break Conditions
(dataframe['bb_delta'] > 0.025) &
(dataframe['bb_width'] > 0.095) &
(dataframe['closedelta'] > close * 17.922 / 1000) &
(dataframe['close'] < bb_lowerband3 * 0.999)

Core Logic: RMI oversold + CCI extreme + Stochastic RSI low, combined with lower Bollinger Band breakout and volatility expansion.


Condition Group 2: Trend Pullback (5 conditions)

#2 Local Uptrend

(dataframe['ema_26'] > dataframe['ema_12']) &
(dataframe['ema_26'] - dataframe['ema_12'] > open * 0.026) &
(dataframe['close'] < bb_lowerband2 * 0.999) &
(dataframe['closedelta'] > close * 17.922 / 1000)

Core Logic: EMA26 > EMA12 (short-term downtrend), price touching 2 standard deviation lower Bollinger Band.

#3 Local Dip

(dataframe['ema_26'] > dataframe['ema_12']) &
(dataframe['close'] < ema_20 * 1.014) &
(dataframe['rsi'] < 21) &
(dataframe['crsi'] > 10)

Core Logic: Local downtrend with deeply oversold RSI but CRSI not at extremes.


Condition Group 3: Elliott Wave (3 conditions)

#4 EWO (Elliott Wave Oscillator)

(dataframe['rsi_fast'] < 44) &
(dataframe['close'] < ema_8 * 0.935) &
(dataframe['EWO'] > -5.001) &
(dataframe['close'] < ema_16 * 0.968) &
(dataframe['rsi'] < 23)

Core Logic: Fast RSI oversold + positive EWO (trend reversal signal) + price below multiple EMAs.

#5 EWO_2

(dataframe['ema_200_1h'] > dataframe['ema_200_1h'].shift(12)) &
(dataframe['ema_200_1h'].shift(12) > dataframe['ema_200_1h'].shift(24)) &
(dataframe['rsi_fast'] < 45) &
(dataframe['EWO'] > 4.179) &
(dataframe['rsi'] < 35)

Core Logic: 1h EMA200 consecutively rising (strong trend) + high positive EWO + RSI oversold.


Condition Group 4: Inverse Dead Fish (1 condition)

#6 R_Deadfish

(dataframe['ema_100'] < ema_200 * 1.054) &
(dataframe['bb_width'] > 0.299) &
(dataframe['close'] < bb_middleband2 * 1.014) &
(dataframe['volume_mean_12'] > volume_mean_24 * 1.59) &
(dataframe['cti'] < -0.115) &
(dataframe['r_14'] < -44.34)

Core Logic: Long-term moving averages in bearish alignment but Bollinger Band width expanding + volume increasing + CTI/Williams %R oversold.


Condition Group 5: ClucHA (1 condition)

#7 ClucHA

(dataframe['rocr_1h'] > 0.526) &
# Sub-condition A: Bollinger Band 40-period breakout
(dataframe['bb_delta_cluc'] > ha_close * 0.049) &
(dataframe['tail'] < bb_delta_cluc * 1.146) &
(dataframe['ha_close'] < bb_lowerband2_40.shift())
# Sub-condition B: Slow EMA breakout
(dataframe['ha_close'] < ema_slow) &
(dataframe['ha_close'] < 0.018 * bb_lowerband2)

Core Logic: Heikin Ashi Bollinger Band breakout + 1h ROCR strength confirmation.


Condition Group 6: COFI (1 condition)

#8 COFI

(dataframe['open'] < ema_8 * 1.147) &
(qtpylib.crossed_above(fastk, fastd)) &
(dataframe['fastk'] < 39) &
(dataframe['fastd'] < 28) &
(dataframe['adx'] > 13) &
(dataframe['EWO'] > 8.594) &
(dataframe['cti'] < -0.892) &
(dataframe['r_14'] < -85.016)

Core Logic: Stochastic Fast golden cross + ADX trend strength + extremely high EWO + multiple oversold confirmations.


Condition Group 7: NFI/NFIX (6 conditions)

#9 NFI_13

(dataframe['ema_50_1h'] > ema_100_1h) &
(dataframe['close'] < sma_30 * 0.99) &
(dataframe['cti'] < -0.92) &
(dataframe['EWO'] < -5.585) &
(dataframe['cti_1h'] < -0.88) &
(dataframe['crsi_1h'] > 10.0)

#10 NFI_32

(dataframe['rsi_slow'] < rsi_slow.shift(1)) &
(dataframe['rsi_fast'] < 46) &
(dataframe['rsi'] > 25.0) &
(dataframe['close'] < sma_15 * 0.93) &
(dataframe['cti'] < -0.9)

#11 NFI_33

(dataframe['close'] < ema_13 * 0.978) &
(dataframe['EWO'] > 8) &
(dataframe['cti'] < -0.88) &
(dataframe['rsi'] < 32) &
(dataframe['r_14'] < -98.0)

#12 NFI_38

(dataframe['pm'] > pmax_thresh) &
(dataframe['close'] < sma_75 * 0.98) &
(dataframe['EWO'] < -4.4) &
(dataframe['cti'] < -0.95) &
(dataframe['r_14'] < -97)

#13 NFIX_5

(dataframe['ema_200_1h'] > ema_200_1h.shift(12)) &
(dataframe['ema_200_1h'].shift(12) > ema_200_1h.shift(24)) &
(dataframe['close'] < sma_75 * 0.932) &
(dataframe['EWO'] > 3.6) &
(dataframe['cti'] < -0.9) &
(dataframe['r_14'] < -97.0)

#14 NFIX_49

# 3-period delayed condition combination
(dataframe['ema_26'].shift(3) > ema_12.shift(3)) &
(dataframe['close'].shift(3) < ema_20.shift(3) * 0.916) &
(dataframe['rsi'].shift(3) < 32.5) &
(dataframe['cti'] < -0.105) &
(dataframe['r_14'] < -81.827)

3.3 Summary Table of 28 Buy Conditions

Condition GroupCondition #Core LogicBacktest Win Rate
BB Breakout#1 BB_checkedDip + Break combination~91.1%
Trend Pullback#2 Local UptrendEMA downtrend pullback~92.4%
Trend Pullback#3 Local DipLocal decline RSI oversold~91.1%
EWO#4 EWOElliott Wave positive~92.0%
EWO#5 EWO_21h EMA200 rising + EWO~89.6%
Dead Fish#6 R_DeadfishInverse dead fish pattern~86.9%
ClucHA#7 ClucHAHA Bollinger breakout~86.6%
COFI#8 COFIStoch cross + ADX~94.4%
NFI#9-14NFI/NFIX series83%-100%
Mirrored 5m#15-285m frame versions of above 14Same as above

IV. Sell Logic Detailed Analysis

4.1 Tiered Trailing Take-Profit System

The strategy uses a 4-level dynamic trailing stop loss:

Profit Range      Protection Stop    Signal Name
─────────────────────────────────────────────────
> 20% 5% custom_stoploss_20
> 10% 3% custom_stoploss_10
> 6% 2% custom_stoploss_6
> 3% 1.5% custom_stoploss_3

Code Implementation:

def custom_stoploss(self, ...):
if (current_profit > 0.2):
sl_new = 0.05 # After 20% profit, only allow 5% pullback
elif (current_profit > 0.1):
sl_new = 0.03
elif (current_profit > 0.06):
sl_new = 0.02
elif (current_profit > 0.03):
sl_new = 0.015
return sl_new

4.2 Profit Trailing Sell (12 signals)

Profit RangeTrigger ConditionSignal Name
0-1.2%max_profit > current + 4.5%, RSI < 46sell_profit_t_0_1
0-1.2%max_profit > current + 2.5%, RSI < 32sell_profit_t_0_2
0-1.2%max_profit > current + 5%, RSI < 48sell_profit_t_0_3
1.2-2%max_profit > current + 1%, RSI < 39sell_profit_t_1_1
1.2-2%CMF double-period negative confirmationsell_profit_t_1_2
1.2-2%CTI_1h > 0.8 + CMF negativesell_profit_t_1_4
.........

4.3 Special Sell Scenarios

ScenarioTrigger ConditionSignal Name
MOMDIVmomdiv_sell_1h = True, profit > 2%signal_profit_q_momdiv_1h
Quick Take Profitprofit 2-6%, RSI > 80signal_profit_q_1
Extreme CTIprofit 2-6%, CTI > 0.95signal_profit_q_2
PMAXPMAX indicator breaks thresholdsignal_profit_q_pmax_bull/bear
Dead Fish Stop Lossprofit < -5%, BB width low, volume shrinkingsell_stoploss_deadfish
Emergency Stop Lossprofit < -5%, CMF/EMA combinationsell_stoploss_u_e_1

V. Technical Indicator System

5.1 Core Indicators

Indicator CategorySpecific IndicatorsUsage
Bollinger BandsBB(20,2), BB(20,3), BB(40,2)Oversold breakout identification
Moving AveragesEMA 8/12/13/16/20/26/50/100/200, SMA 9/15/21/30/75Trend determination
MomentumRSI(4/14/20), RMI, CCI, StochRSI, StochFastOversold/overbought determination
VolatilityCTI, Williams %R(14/32/64/96/480), CRSIExtreme value identification
VolumeCMF, Volume_mean, MFILiquidity determination
SpecialEWO, PMAX, MOMDIV, ROCRAdvanced signals

5.2 Info Timeframe Indicators (1h)

The strategy uses 1h as the information layer, providing higher-dimensional trend judgment:

  • EMA 50/100/200 for long-term trend direction
  • CTI_1h, CRSI_1h, RSI_1h for cross-period momentum confirmation
  • BB_width_1h, ROC_1h for volatility filtering
  • MOMDIV_1h for momentum divergence signals
  • Williams %R(480) for long-period extremes

5.3 Info Timeframe Indicators (5m)

The strategy additionally uses 5m as an information layer, building mirrored buy conditions:

  • All 14 conditions from the 3m frame are recalculated on the 5m frame
  • Provides more granular entry opportunities
  • Must pass the same additional check conditions

VI. Risk Management Features

6.1 Tiered Trailing Stop Loss

Automatically tightens stop loss after profit, achieving "more profit, tighter protection":

# After 20% profit, only allow 5% pullback
# After 10% profit, only allow 3% pullback
# After 6% profit, only allow 2% pullback
# After 3% profit, only allow 1.5% pullback

6.2 Slippage Confirmation Mechanism

Verifies actual entry price through confirm_trade_entry function:

slippage = (rate / dataframe['close'] - 1) * 100
if slippage < max_slip: # Default 0.33%
return True

6.3 Dead Fish Stop Loss

Special stop loss scenario for liquidity exhaustion:

(current_profit < -0.05) &
(close < ema_200) &
(bb_width < 0.043) &
(close > bb_middleband2 * 0.954) &
(volume_mean_12 < volume_mean_24 * 2.37)

VII. Strategy Advantages and Limitations

✅ Advantages

  1. Rich Signals: 28 buy conditions cover various market patterns, reducing missed trade risk
  2. Flexible Stop Loss: Tiered trailing stop loss balances profit protection with trend following
  3. Cross-Period Confirmation: 5m + 1h information frames improve signal reliability
  4. Slippage Protection: Entry confirmation mechanism prevents abnormal price execution
  5. Hyperopt Tunable: Many parameters support hyperparameter optimization

⚠️ Limitations

  1. Computational Complexity: Three-timeframe indicator calculations require significant hardware resources
  2. Many Parameters: Large Hyperopt space, time-consuming optimization
  3. Overfitting Risk: 28 conditions may lead to inflated historical backtest results
  4. Live Trading Differences: Complex logic may produce unexpected behavior in live trading
  5. High Trading Frequency: 3m frame may lead to high-frequency trading, transaction costs need attention

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Slow Bull TrendEnable EWO_2, NFIX seriesTrend pullback strategies perform well
Oscillating MarketEnable BB_checked, ClucHABollinger Band breakout captures volatility
Fast DeclineEnable NFI_13, Local DipDeep oversold bottom-fishing conditions
High Volatility CoinsLower max_slip, raise stop lossReduce abnormal execution risk

IX. Applicable Market Environment Details

BB_RPB_TSL_2 is one of the most complex strategies in the Freqtrade community. Based on its code architecture and community long-term live trading verification, it is best suited for oscillating pullback markets, while performing poorly during rapid crashes.

9.1 Strategy Core Logic

  • Multi-Condition Coverage: 28 buy signals cover oversold, pullback, breakout, and other patterns
  • Tiered Stop Loss: More profit leads to tighter stop loss, adapting to multiple entries in oscillating markets
  • Cross-Period Confirmation: 1h trend filter + 5m mirrored conditions, improving signal quality

9.2 Performance in Different Market Environments

Market TypePerformance RatingReason Analysis
📈 Slow Bull Trend⭐⭐⭐⭐⭐EWO_2, NFIX series capture trend pullbacks, tiered stop loss protects profits
🔄 Oscillating Market⭐⭐⭐⭐☆BB_checked, ClucHA capture Bollinger Band breakouts, frequent entries
📉 Slow Bear Decline⭐⭐⭐☆☆Local Dip, NFI_13 bottom-fishing has risk, stop loss may trigger too early
⚡️ Rapid Crash⭐☆☆☆☆Dead Fish stop loss may fail when liquidity dries up
📊 Sideways Consolidation⭐⭐☆☆☆Few condition triggers, low capital utilization

9.3 Key Configuration Recommendations

Configuration ItemRecommended ValueDescription
max_slip0.33%-0.50%Balance execution rate with price protection
stoploss-0.10 to -0.15Adjust based on coin volatility
Number of Trading Pairs10-30Diversify risk, avoid single-coin concentration
stake_amountDynamic or small fixedHigh-frequency trading requires controlled single position size

X. Important Reminder: The Cost of Complexity

10.1 Learning Cost

BB_RPB_TSL_2 has over 800 lines of code, including:

  • 28 buy condition combinations
  • 20+ sell signals
  • 3 timeframe indicator calculations
  • Custom stop loss logic

Understanding each condition's purpose requires significant time investment.

10.2 Hardware Requirements

Number of Trading PairsMinimum MemoryRecommended Memory
10-204 GB8 GB
30-508 GB16 GB
50+16 GB32 GB

Warning: Three-timeframe indicator calculations will cause high CPU load. Multi-core VPS is recommended.

10.3 Backtest vs Live Trading Differences

Complex strategies' backtest performance is often extremely excellent, but live trading may show:

  • Order execution delays causing missed signals
  • Slippage exceeding expectations causing premature stop loss triggers
  • Inability to exit at expected prices when liquidity is insufficient

10.4 Manual Trader Recommendations

Manual traders are not recommended to attempt replicating this strategy:

  • Real-time judgment of 28 conditions is nearly impossible
  • Tiered stop loss requires precise calculation of current profit rate
  • Multi-timeframe switching judgment is difficult

XI. Summary

BB_RPB_TSL_2 is a typical "player" strategy—capturing various market opportunities through numerous buy conditions. Its core value lies in:

  1. Comprehensive Coverage: 28 conditions cover oversold, pullback, breakout, trend, and other patterns
  2. Intelligent Stop Loss: Tiered trailing stop loss balances profit protection with trend following
  3. Strict Verification: Slippage confirmation + additional checks filter low-quality signals

For quantitative traders, this strategy is suitable for experienced users who need:

  • Adequate hardware resources
  • Deep understanding of parameter optimization
  • Live testing to verify backtest result reliability