BB_RPB_TSL_Tranz Strategy In-Depth Analysis
Strategy Number: #450 (450th out of 465 strategies)
Strategy Type: Bollinger Band Pullback + Real Pull Back + Dynamic Trailing Stop
Timeframes: 5-minute (5m) + 1-hour (1h) + 15-minute (15m)
I. Strategy Overview
BB_RPB_TSL_Tranz is a classic strategy based on Bollinger Bands and the Real Pull Back (RPB) concept. This strategy originates from jilv220's design, integrating multiple mature buy signals and employing a dynamic trailing stop mechanism for risk management. It is the core version of the BB_RPB_TSL series, with clear code structure, suitable for learning and secondary development.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 40 independent buy signals covering pullback, breakout, oscillation, and other scenarios |
| Sell Conditions | Multi-tier trailing profit-taking + custom sell signals |
| Protection Mechanisms | Slippage protection, entry confirmation mechanism |
| Timeframes | Main timeframe 5m, informative timeframes 1h + 15m |
| Dependencies | pandas_ta, technical, freqtrade, numpy, talib |
II. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.205, # Exit immediately at 20.5% profit
"81": 0.038, # Exit at 3.8% after 81 minutes
"292": 0.005, # Exit at 0.5% after 292 minutes
}
# Stop Loss Settings
stoploss = -0.10 # 10% fixed stop loss
# Enable Custom Stop Loss
use_custom_stoploss = True
# Enable Sell Signals
use_sell_signal = True
Design Philosophy:
- ROI table is relatively loose, giving more profit space
- Fixed stop loss is more aggressive (10%), suitable for short-term trading
- Staged profit targets reduce position holding time pressure
2.2 Custom Stop Loss Mechanism
def custom_stoploss(self, pair, trade, current_time, current_rate, current_profit, **kwargs):
if (current_profit > 0.2):
return 0.05 # Move stop loss to 5% when profit >20%
elif (current_profit > 0.1):
return 0.03 # Move stop loss to 3% when profit >10%
elif (current_profit > 0.06):
return 0.02 # Move stop loss to 2% when profit >6%
elif (current_profit > 0.03):
return 0.015 # Move stop loss to 1.5% when profit >3%
return 1 # Use fixed stop loss by default
III. Buy Conditions Detailed Analysis
3.1 Core Buy Signal Classification
The strategy's buy conditions can be categorized into the following groups:
| Condition Group | Number of Conditions | Core Logic |
|---|---|---|
| Bollinger Band Pullback | 5 | Price touches BB lower band, suitable for oversold bounce |
| Trend Pullback | 8 | Seek pullback buy opportunities in uptrend |
| NFI Series Signals | 20+ | Deep pullback signals from NFI strategy |
| Momentum Reversal | 5 | CTI, RSI and other momentum indicator extreme reversals |
| Auxiliary Signals | 5 | Multi-timeframe confirmation signals |
3.2 Typical Buy Condition Examples
Condition #1: Bollinger Band Pullback (bb)
is_BB_checked = (
(rmi < 49) & # RMI Relative Momentum Index low
(cci <= -116) & # CCI Commodity Channel Index oversold
(srsi_fk < 32) # Stochastic RSI fast line low
) & (
(bb_delta > 0.025) & # Sufficient spacing between BB lower band and lower band 3
(bb_width > 0.095) & # BB width sufficient
(close < bb_lowerband3 * 0.999) # Price touches BB 3 standard deviation lower band
)
Condition #2: Local Uptrend Pullback (local_uptrend)
is_local_uptrend = (
is_additional_check & # Auxiliary check conditions
(ema_26 > ema_12) & # Short-term MA above long-term MA
(ema_26 - ema_12 > open * 0.026) & # MA gap sufficient
(close < bb_lowerband2 * 0.999) # Price touches BB 2 standard deviation lower band
)
Condition #3: NFI Series (nfix_39)
is_nfix_39 = (
is_additional_check &
(ema_200_1h > ema_200_1h.shift(12)) & # 1h EMA200 uptrend
(bb_lowerband2_40.shift() > 0) & # BB lower band valid
(close < bb_lowerband2_40.shift()) & # Price touches BB lower band
(close > ema_13 * 0.912) # Price above EMA13 at certain distance
)
3.3 Auxiliary Filter Conditions
# Additional Check Conditions
is_additional_check = (
(roc_1h < 86) & # 1-hour ROC should not be too high
(bb_width_1h < 0.954) # 1-hour BB width moderate
)
IV. Sell Logic Detailed Analysis
4.1 Trailing Profit-Taking System
The strategy employs a multi-tier trailing profit-taking mechanism:
# 0% ~ 1.2% profit 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"
elif (max_profit > (current_profit + 0.025)) and (rsi < 32.0):
return "sell_profit_t_0_2"
# ...
# 1.2% ~ 2% profit 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"
# ...
4.2 Special Sell Scenarios
| Scenario | Trigger Condition | Signal Name |
|---|---|---|
| Quick Profit-Taking | Profit 2-6% and RSI > 80 | signal_profit_q_1 |
| Momentum Extreme | Profit 2-6% and CTI > 0.95 | signal_profit_q_2 |
| PMAX Signal | Price breaks PMAX threshold | signal_profit_q_pmax_* |
| Below Moving Average | Price < EMA200 and profitable | sell_profit_u_bear_* |
| Stop Loss - Deadfish | Multiple conditions combined | sell_stoploss_deadfish |
4.3 Base Sell Signals
# MOMDIV Sell Signal
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"
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicators | Usage |
|---|---|---|
| Trend Indicators | EMA (4, 8, 12, 13, 16, 20, 26, 50, 100, 200) | Trend direction judgment |
| Trend Indicators | SMA (9, 15, 20, 21, 28, 30, 75) | Support/resistance levels |
| Oscillator Indicators | RSI (4, 14, 20) | Overbought/oversold judgment |
| Volatility Indicators | Bollinger Bands (20, 2), (20, 3), (40, 2) | Volatility channels |
| Momentum Indicators | CCI, CTI, Williams %R (14, 32, 64, 96, 480) | Momentum extremes |
| Volume Indicators | CMF, MFI, Volume Mean | Volume-price analysis |
| Composite Indicators | EWO (Elliott Wave Oscillator), PMAX, T3 | Trend strength |
5.2 Informative Timeframe Indicators
1-hour Timeframe:
- EMA series (8, 12, 20, 25, 26, 35, 50, 100, 200)
- RSI 14
- CTI (20, 40)
- Williams %R (96, 480)
- BB 20 (2 standard deviations)
- CMF (Chaikin Money Flow)
15-minute Timeframe:
- RSI 14
- EMA series
- SMA series
- BB 40 (2 standard deviations)
- Williams %R (14, 64, 96)
- EWO
VI. Risk Management Features
6.1 Slippage Protection
def confirm_trade_entry(self, pair, order_type, amount, rate, time_in_force, **kwargs):
dataframe = self.dp.get_analyzed_dataframe(pair, self.timeframe)
dataframe = dataframe.iloc[-1].squeeze()
if (rate > dataframe['close']):
slippage = ((rate / dataframe['close']) - 1) * 100
if slippage < self.max_slip.value: # Default 0.33%
return True
else:
return False
return True
6.2 Entry Confirmation Mechanism
The strategy implements entry confirmation through the confirm_trade_entry method:
- Checks if slippage is within acceptable range
- Prevents entry during violent price fluctuations
6.3 Multi-timeframe Confirmation
Buy signals need to satisfy auxiliary check conditions:
- 1-hour ROC cannot be too high
- 1-hour BB width moderate
VII. Strategy Advantages and Limitations
✅ Advantages
- Rich Signals: 40 buy conditions cover multiple market scenarios
- Clear Code: Compared to MOD version, code structure is more concise
- Trailing Profit-Taking: Automatically takes profit when price pulls back from highs
- Slippage Protection: Entry confirmation mechanism prevents excessive slippage
- Multi-timeframe Confirmation: Uses 1h and 15m timeframes to filter false signals
⚠️ Limitations
- Many Parameters: Many optimizable parameters, requires tuning experience
- Computationally Intensive: Multi-timeframe and multi-indicator calculations have hardware requirements
- Tight Stop Loss: 10% fixed stop loss may stop out too early during violent volatility
- Not Suitable for Chasing Highs: Strategy偏向 bottom-fishing, misses strong upward trends
VIII. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Slow Bull Trend | Default configuration | Trend pullback signals perform excellently |
| Wide Oscillation | Enable more pullback signals | Bollinger Band pullback signals work well |
| Post-Crash Rebound | Enable NFI series | Deep pullback signals capture rebounds |
| Rapid Rise | Use with caution | Strategy偏向 bottom-fishing, may miss opportunities |
| Single-sided Bear | Reduce trading frequency | Many signals trigger but high risk |
IX. Applicable Market Environment Detailed Analysis
BB_RPB_TSL_Tranz is the core version of the BB_RPB_TSL series. Based on its code architecture and community experience, it is best suited for trend pullback markets, and performs poorly in single-sided pumps or deep bear markets.
9.1 Strategy Core Logic
- Bollinger Band Pullback: Wait for price to touch Bollinger Band lower band
- Trend Pullback: Seek entry points on pullbacks in uptrends
- Trailing Profit-Taking: Lock in profits when price pulls back from highs
- Dynamic Stop Loss: Adjust stop loss position as profit increases
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Slow Bull Trend | ⭐⭐⭐⭐⭐ | Pullback buy signals are precise, profit-taking mechanism is reasonable |
| 🔄 Wide Oscillation | ⭐⭐⭐⭐☆ | Bollinger Band signals are effective, fees moderate |
| 📉 Single-sided Decline | ⭐⭐☆☆☆ | Many buy signals trigger, but frequent stop losses |
| ⚡️ Rapid Pump | ⭐☆☆☆☆ | Strategy偏向 bottom-fishing, high risk of missing opportunities |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| Stop Loss | -0.10 | As final safety net, can adjust based on risk preference |
| Minimum ROI | 0.005 | Minimum profit target |
| Slippage Threshold | 0.33% | Prevents excessive slippage |
X. Important Reminder: The Cost of Complexity
10.1 Learning Cost
The strategy contains multiple optimizable parameters. Full understanding requires:
- Familiarity with basic indicators like Bollinger Bands, RSI, EMA
- Understanding of Elliott Wave Theory (EWO)
- Mastery of advanced indicators like CTI, CMF
- Knowledge of NFI series signal underlying logic
10.2 Hardware Requirements
| Number of Pairs | Minimum RAM | Recommended RAM |
|---|---|---|
| 1-10 pairs | 4GB | 8GB |
| 10-30 pairs | 8GB | 16GB |
| 30+ pairs | 16GB | 32GB |
10.3 Differences Between Backtest and Live Trading
- Strategy may perform excellently in backtests
- In live trading, slippage, latency, liquidity and other factors have significant impact
- Recommended to test thoroughly in simulated environment first
10.4 Manual Trader Recommendations
If you want to apply this strategy's logic to manual trading:
- Focus on Bollinger Band lower band 2-3 standard deviation prices
- Watch for RSI below 30
- Seek pullback opportunities above EMA 200
- Consider taking profit when profit pulls back from highs
XI. Summary
BB_RPB_TSL_Tranz is a well-designed multi-signal strategy. Its core value lies in:
- Signal Diversity: Covers multiple entry scenarios including pullback, breakout, and oscillation
- Trailing Profit-Taking: Automatically locks in profits when price pulls back
- Dynamic Stop Loss: Automatically adjusts risk exposure as profit changes
- Slippage Protection: Entry confirmation mechanism prevents getting screwed
For quantitative traders, this is a strategy template worth learning and developing further. Compared to the MOD version, its code is more concise, more suitable for入门 learning.
Applicable to Freqtrade quantitative trading framework