Skip to main content

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

FeatureDescription
Buy Conditions14 independent buy signal groups covering trend, oversold, reversal, and other scenarios
Sell ConditionsMulti-layer dynamic take-profit system + custom stop loss logic + signal exit
Protection MechanismsBTC crash protection, 1h information layer validation, slippage filtering, custom stop loss
Timeframe5m main framework + 1h information timeframe
Dependenciesqtpylib, 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 TypeParameter DescriptionDefault Value Example
BTC ProtectionBTC crash thresholdbuy_btc_safe=-200
1h ValidationROC and BB_width validationbuy_roc_1h=4, buy_bb_width_1h=1.074
Slippage FilterMaximum allowed slippage percentagemax_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 GroupCondition NumberCore LogicBacktest Win Rate
BB Combination1dip + break Bollinger Band oversold resonance~90.9%
Local Trend2BB pullback in EMA uptrend~92.3%
Local Dip3RSI oversold in uptrend~97.8%
EWO4Elliott Wave + RSI oversold~86.4%
EWO_251h EMA200 trend + EWO~87%
Reverse Deadfish6Weak rebound opportunities~93.9%
ClucHA7Heikin Ashi BB oversold~93.4%
Cofi8Stoch golden cross + ADX strength~89.1%
NFI_1391h validation + CTI extreme~100%
NFI_3210RSI combination oversold~92%
NFI_3311EWO high + CTI extreme~100%
NFI_3812PMAX + CTI extreme~83.2%
NFIX_5131h trend + SMA oversold~97.7%
NFIX_4914Delayed EMA trend combination~100%
NFIX_5115Delayed 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

ScenarioTrigger ConditionSignal Name
0-1.2% profitMax profit drawdown 4.5% + RSI<46sell_profit_t_0_1
0-1.2% profitMax profit drawdown 2.5% + RSI<32sell_profit_t_0_2
1.2-2% profitMax profit drawdown 1% + RSI<39sell_profit_t_1_1
1.2-2% profitDrawdown 3.5% + RSI<45 + CMF<0sell_profit_t_1_2

Quick Take-Profit Signals

ScenarioTrigger ConditionSignal Name
2-6% profitRSI>80 overboughtsignal_profit_q_1
2-6% profitCTI>0.95 extremesignal_profit_q_2
2-6% profitPMAX conditionssignal_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

ScenarioTrigger ConditionSignal Name
Bear market stop lossLoss>5% + EMA200 deviation + CMF<0sell_stoploss_u_e_1
Deadfish stop lossLoss>5% + BB width small + volume lowsell_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 CategorySpecific IndicatorsUsage
Bollinger BandsBB 20/2σ, BB 20/3σ, BB 40/2σOversold judgment, bandwidth analysis
Trend IndicatorsEMA 8/12/16/26/50/100/200, SMA 9/15/21/30/75Trend judgment, support levels
Momentum IndicatorsRSI 4/14/20, CCI 26/170, RMI, CRSIOversold/overbought judgment
Volatility IndicatorsCTI (Correlation Trend Indicator), Williams %R 14/32/64/96/480Extreme value capture
Volumevolume_mean_4/12/24, CMF 20Volume validation
SpecialEWO (Elliott Wave Oscillator), PMAX, MOMDIVAdvanced 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

  1. Multi-condition resonance: 14 buy conditions cover various market scenarios, improving entry precision
  2. Dynamic stop loss: Tiered trailing stop loss system, balancing profit locking and trend following
  3. Multi-timeframe: 5m + 1h dual-layer validation, reducing false signal risk
  4. BTC protection: Systemic risk protection, avoiding entry during major market crashes
  5. Rich exit logic: Multiple take-profit, stop-loss, signal exit combinations

⚠️ Limitations

  1. High complexity: 14 buy conditions + multi-layer sell logic, difficult to understand and debug
  2. Numerous parameters: Large number of Hyperopt parameters, higher overfitting risk
  3. High computational load: Multiple indicators and 1h information layer require good hardware support
  4. External indicator dependencies: Uses RMI, zema, etc. from technical.indicators library

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Oscillating declineEnable all buy conditionsMulti-condition capture of oversold rebound opportunities
Moderate trendKeep EWO, BB combinationTrend pullback entry
High volatilityEnable BTC protectionPrevent systemic risk
Low volatilityLower BB_width thresholdMore 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 TypePerformance RatingReason 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 ItemSuggested ValueDescription
max_slip0.5-0.8Appropriately relax slippage limits in high volatility markets
buy_bb_width0.08-0.12Adjust Bollinger Band width sensitivity
BTC protection thresholdAdjust according to marketTighten 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 PairsMinimum MemoryRecommended Memory
10-20 pairs4GB8GB
50+ pairs8GB16GB

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:

  1. Multi-layer validation system: From BTC protection, 1h information layer to slippage filter, building safe entry mechanism
  2. Rich buy scenario coverage: 14 condition groups cover trend pullback, oversold rebound, extreme reversal and other opportunities
  3. 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.