BB_RPB_TSL_RNG Strategy In-Depth Analysis
Strategy Number: #442 (442nd out of 465 strategies) Strategy Type: Bollinger Band Pullback Strategy + Advanced Trailing Stop Loss System Timeframe: 5-minute (5m)
I. Strategy Overview
BB_RPB_TSL_RNG is a streamlined version of the BB_RPB_TSL series, retaining the core oversold capture logic while adopting a more sophisticated linear interpolation trailing stop loss system. Compared to BIV1's 14 buy conditions, the RNG version retains only 7 core conditions, making it more suitable for traders pursuing simplicity and efficiency.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 7 independent buy signal groups, focusing on core oversold scenarios |
| Sell Conditions | Linear interpolation trailing stop loss + base signal sell |
| Protection Mechanisms | BTC crash protection + buy condition switches + slippage filter |
| Timeframe | 5m main framework |
| Dependencies | qtpylib, numpy, talib, pandas_ta, technical.indicators |
II. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.10, # 10% 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 set at 10%, more conservative than BIV1
- Mainly relies on custom trailing stop loss for exit
- Fixed stop loss serves only as backup protection
2.2 Linear Interpolation Trailing Stop Loss System
def custom_stoploss(...):
# Hard stop loss profit
HSL = self.pHSL.value # -0.178
# Profit threshold 1: trigger point, SL_1 usage
PF_1 = self.pPF_1.value # 0.019
SL_1 = self.pSL_1.value # 0.019
# Profit threshold 2: SL_2 usage
PF_2 = self.pPF_2.value # 0.065
SL_2 = self.pSL_2.value # 0.062
# Linear interpolation calculation
if (current_profit > PF_2):
sl_profit = SL_2 + (current_profit - PF_2)
elif (current_profit > PF_1):
sl_profit = SL_1 + ((current_profit - PF_1) * (SL_2 - SL_1) / (PF_2 - PF_1))
else:
sl_profit = HSL
return stoploss_from_open(sl_profit, current_profit)
Design Philosophy:
- In profit range PF_1 to PF_2, stop loss value linearly interpolates, smooth transition
- After profit exceeds PF_2, stop loss grows linearly with profit, dynamically adapting
- When profit is below PF_1, uses hard stop loss HSL
- Compared to BIV1's tiered stop loss, RNG uses continuous linear function, smoother
2.3 Trailing Stop Loss Parameters Detailed
| Parameter | Default Value | Optimization Range | Description |
|---|---|---|---|
| pHSL | -0.178 | -0.200 ~ -0.040 | Hard stop loss profit threshold |
| pPF_1 | 0.019 | 0.008 ~ 0.020 | Profit threshold 1 (first stage trigger point) |
| pSL_1 | 0.019 | 0.008 ~ 0.020 | First stage stop loss value |
| pPF_2 | 0.065 | 0.040 ~ 0.100 | Profit threshold 2 (second stage trigger point) |
| pSL_2 | 0.062 | 0.020 ~ 0.070 | Second stage stop loss value |
III. Buy Conditions Detailed Analysis
3.1 Protection Mechanisms
The strategy employs multi-layer protection design:
| Protection Type | Parameter Description | Implementation |
|---|---|---|
| BTC Protection | BTC crash threshold | buy_btc_safe=-289, buy_btc_safe_1d=-0.05 |
| Condition Switches | dip/break conditions can be independently enabled/disabled | CategoricalParameter |
| Slippage Filter | Maximum allowed slippage | confirm_trade_entry |
3.2 7 Buy Conditions Detailed
Condition #1: Bollinger Band Combination (is_BB_checked)
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 > 0.025
(dataframe['bb_width'] > buy_bb_width.value) & # BB width > 0.095
(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.
Feature: dip or break conditions can be independently enabled/disabled via CategoricalParameter.
Condition #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 > open*0.022
(dataframe['close'] < dataframe['bb_lowerband2'] * ...) # Price pulls back to lower band
)
Source: NFI Next Gen strategy approach, capturing pullback opportunities in uptrend.
Conditions #3-4: EWO Series (is_ewo, is_ewo_2)
is_ewo = (
(dataframe['rsi_fast'] < buy_rsi_fast.value) & # RSI_fast < 45
(dataframe['close'] < dataframe['ema_8'] * buy_ema_low.value) &
(dataframe['EWO'] > buy_ewo.value) & # EWO > -5.585
...
)
is_ewo_2 = (
(dataframe['rsi_fast'] < buy_rsi_fast.value) &
(dataframe['close'] < dataframe['ema_8'] * buy_ema_low_2.value) &
(dataframe['EWO'] > buy_ewo_high.value) & # EWO > 4.179
...
)
Difference: is_ewo uses negative EWO threshold, is_ewo_2 uses positive threshold, capturing trend signals of different strengths.
Condition #5: Cofi (is_cofi)
is_cofi = (
(dataframe['open'] < dataframe['ema_8'] * buy_ema_cofi.value) &
(qtpylib.crossed_above(dataframe['fastk'], dataframe['fastd'])) &
(dataframe['fastk'] < buy_fastk.value) & # fastk < 22
(dataframe['fastd'] < buy_fastd.value) & # fastd < 20
(dataframe['adx'] > buy_adx.value) & # ADX > 20
(dataframe['EWO'] > buy_ewo_high.value) & # EWO > 4.179
)
Core Logic: Stoch fast line golden cross + ADX strength + EWO trend confirmation.
Conditions #6-7: NFI Series (is_nfi_32, is_nfi_33)
is_nfi_32 = (
(dataframe['rsi_slow'] < dataframe['rsi_slow'].shift(1)) &
(dataframe['rsi_fast'] < 46) &
(dataframe['rsi'] > 19) &
(dataframe['close'] < dataframe['sma_15'] * 0.942) & # SMA oversold
(dataframe['cti'] < -0.86) # CTI extreme
)
is_nfi_33 = (
(dataframe['close'] < dataframe['ema_13'] * 0.978) &
(dataframe['EWO'] > 8) &
(dataframe['cti'] < -0.88) &
(dataframe['rsi'] < 32) &
(dataframe['r_14'] < -98.0) & # Williams %R extreme
(dataframe['volume'] < dataframe['volume_mean_4'] * 2.5)
)
Core Logic: Capture extreme oversold opportunities, CTI, Williams %R and other indicators resonance.
3.3 Buy Conditions Summary
| Condition Group | Condition Number | Core Logic | Backtest Win Rate Reference |
|---|---|---|---|
| BB Combination | 1 | dip + break Bollinger Band oversold resonance | ~89% |
| Local Trend | 2 | BB pullback in EMA uptrend | ~90.2% |
| EWO | 3 | Elliott Wave + RSI oversold | ~93.5% |
| EWO_2 | 4 | EWO positive + RSI combination | ~90.3% |
| Cofi | 5 | Stoch golden cross + ADX strength | ~90.8% |
| NFI_32 | 6 | RSI combination + CTI extreme | ~91.3% |
| NFI_33 | 7 | EWO high + Williams %R extreme | ~100% |
IV. Sell Logic Detailed Analysis
4.1 Linear Interpolation Trailing Stop Loss System
The strategy employs an innovative linear interpolation trailing stop loss:
Profit Range Stop Loss Calculation Method
─────────────────────────────────────────────────────────
< PF_1 (1.9%) Use hard stop loss HSL (-17.8%)
PF_1 ~ PF_2 Linear interpolation from SL_1 to SL_2
> PF_2 (6.5%) SL_2 + (profit - PF_2)
Visual Understanding:
- Profit 0% → Stop loss -17.8% (hard stop loss)
- Profit 1.9% → Stop loss 1.9% (start trailing)
- Profit 6.5% → Stop loss 6.2% (tighter trailing)
- Profit 10% → Stop loss 6.2% + (10% - 6.5%) = 9.7%
4.2 Base Sell Signals (populate_exit_trend)
# Sell Signal 1: Trend Reversal
(
(dataframe['close'] > dataframe['sma_9']) &
(dataframe['close'] > ma_sell_{...} * high_offset_2) &
(dataframe['rsi'] > 50) &
(dataframe['rsi_fast'] > dataframe['rsi_slow'])
)
# Sell Signal 2: Price Deviation
(
(dataframe['sma_9'] > sma_9.shift(1) + sma_9.shift(1)*0.005) &
(dataframe['close'] < dataframe['hma_50']) &
(dataframe['close'] > ma_sell_{...} * high_offset) &
(dataframe['rsi_fast'] > dataframe['rsi_slow'])
)
4.3 Sell Parameters Detailed
| Parameter | Default Value | Description |
|---|---|---|
| base_nb_candles_sell | 24 | EMA sell period |
| high_offset | 0.991 | Sell offset coefficient 1 |
| high_offset_2 | 0.997 | Sell offset coefficient 2 |
| sell_btc_safe | -389 | BTC sell protection threshold |
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicators | Usage |
|---|---|---|
| Bollinger Bands | BB 20/2σ, BB 20/3σ | Oversold judgment, bandwidth analysis |
| Trend Indicators | EMA 8/12/13/16/26, SMA 9/15/30, HMA 50 | Trend judgment, support levels |
| Momentum Indicators | RSI 4/14/20, CCI 26/170, RMI | Oversold/overbought judgment |
| Volatility Indicators | CTI, Williams %R 14 | Extreme value capture |
| Volume | volume_mean_4 | Volume validation |
| Special | EWO (Elliott Wave Oscillator), ADX | Advanced signals |
5.2 BTC Information Layer Indicators
The strategy monitors BTC/USDT 5m data as market barometer:
informative = self.dp.get_pair_dataframe('BTC/USDT', timeframe='5m')
informative_past = informative.copy().shift(1)
informative_threshold = informative_past_source * buy_threshold.value
informative_diff = informative_threshold - informative_past_delta
VI. Risk Management Features
6.1 BTC Protection Mechanism
buy_btc_safe = IntParameter(-300, 50, default=-289)
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 5-minute crash exceeds threshold, pause buying
- When BTC 1-day crash exceeds threshold, additional validation
6.2 Buy Condition Switches
buy_is_dip_enabled = CategoricalParameter([True, False], default=True)
buy_is_break_enabled = CategoricalParameter([True, False], default=True)
Feature: dip and break conditions can be independently enabled/disabled, flexibly adjusting entry strictness.
6.3 Slippage Filter (confirm_trade_entry)
The strategy validates the deviation between actual trade price and theoretical price before entry.
VII. Strategy Advantages and Limitations
✅ Advantages
- Simple and efficient: Only 7 buy conditions, easier to understand and manage compared to BIV1's 14
- Linear interpolation stop loss: Stop loss value changes continuously, smoother than tiered stop loss
- Flexible condition switches: Can independently enable/disable buy conditions, adapting to different markets
- BTC protection: Systemic risk protection mechanism
⚠️ Limitations
- No 1h information layer: Compared to BIV1, lacks 1h information layer validation, may increase false signal risk
- Many trailing stop parameters: 5 trailing stop parameters, difficult to tune
- BTC data dependency: Requires BTC/USDT pair data support
- Many Hyperopt parameters: Still has many optimization parameters, need to be alert to overfitting
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 + disable partial conditions | Reduce entry frequency |
| Low volatility | Lower BB_width threshold | More sensitive oversold capture |
IX. Applicable Market Environment Detailed Analysis
BB_RPB_TSL_RNG is a streamlined version of the BB_RPB_TSL series. Based on its code architecture, it is most suitable for oscillating decline markets, while performing poorly in strong uptrend markets.
9.1 Strategy Core Logic
- Streamlined oversold capture: 7 core buy conditions, covering main oversold scenarios
- Linear trailing stop loss: Stop loss value changes continuously within profit range, smooth transition
- BTC barometer: Judges overall market risk through BTC/USDT data
- Flexible switches: Can adjust dip/break condition enablement status
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Strong uptrend | ⭐⭐☆☆☆ | Few pullback opportunities, misses main rally |
| 🔄 Oscillating decline | ⭐⭐⭐⭐⭐ | Oversold capture mechanism perfectly matches |
| 📉 Continuous crash | ⭐⭐☆☆☆ | BTC protection pauses buying |
| ⚡️ High volatility oscillation | ⭐⭐⭐☆☆ | Condition switches can adjust sensitivity |
9.3 Key Configuration Recommendations
| Configuration Item | Suggested Value | Description |
|---|---|---|
| pHSL | -0.08 ~ -0.12 | Adjust hard stop loss according to risk tolerance |
| pPF_1/pPF_2 | Keep default | Profit thresholds already optimized |
| buy_threshold | 0.005 ~ 0.01 | BTC protection sensitivity |
X. Important Reminder: The Cost of Complexity
10.1 Learning Cost
The strategy contains 7 buy conditions, linear interpolation trailing stop loss system, BTC protection mechanism. Understanding requires:
- Bollinger Band theoretical foundation
- Elliott Wave Oscillator principles
- CTI, Williams %R and other indicator meanings
- Linear interpolation stop loss mathematical principles
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
- BTC protection impact: Live trading BTC crash protection reduces entry opportunities
- Stop loss parameter sensitivity: Trailing stop loss parameter tuning is more difficult
- No 1h validation: Compared to BIV1, signal reliability may be slightly lower
10.4 Manual Trader Recommendations
Not recommended for manual traders to directly imitate this strategy logic:
- Linear interpolation stop loss requires real-time calculation
- BTC protection requires real-time BTC data monitoring
- Condition judgment has high real-time requirements
XI. Summary
BB_RPB_TSL_RNG is a streamlined efficient oversold capture strategy, with core value in:
- Simple design: 7 core buy conditions, easy to understand and manage
- Innovative stop loss: Linear interpolation trailing stop loss, smooth transition
- Flexible configuration: Buy condition switches can be independently adjusted
For quantitative traders, this strategy is suitable for traders pursuing simplicity and efficiency, but attention should be paid to potential risks from lacking 1h information layer validation. It is recommended to combine with BTC protection mechanism, test with small positions in oscillating markets first before gradually increasing.