Skip to main content

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

FeatureDescription
Buy Conditions40 independent buy signals covering pullback, breakout, oscillation, and other scenarios
Sell ConditionsMulti-tier trailing profit-taking + custom sell signals
Protection MechanismsSlippage protection, entry confirmation mechanism
TimeframesMain timeframe 5m, informative timeframes 1h + 15m
Dependenciespandas_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 GroupNumber of ConditionsCore Logic
Bollinger Band Pullback5Price touches BB lower band, suitable for oversold bounce
Trend Pullback8Seek pullback buy opportunities in uptrend
NFI Series Signals20+Deep pullback signals from NFI strategy
Momentum Reversal5CTI, RSI and other momentum indicator extreme reversals
Auxiliary Signals5Multi-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

ScenarioTrigger ConditionSignal Name
Quick Profit-TakingProfit 2-6% and RSI > 80signal_profit_q_1
Momentum ExtremeProfit 2-6% and CTI > 0.95signal_profit_q_2
PMAX SignalPrice breaks PMAX thresholdsignal_profit_q_pmax_*
Below Moving AveragePrice < EMA200 and profitablesell_profit_u_bear_*
Stop Loss - DeadfishMultiple conditions combinedsell_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 CategorySpecific IndicatorsUsage
Trend IndicatorsEMA (4, 8, 12, 13, 16, 20, 26, 50, 100, 200)Trend direction judgment
Trend IndicatorsSMA (9, 15, 20, 21, 28, 30, 75)Support/resistance levels
Oscillator IndicatorsRSI (4, 14, 20)Overbought/oversold judgment
Volatility IndicatorsBollinger Bands (20, 2), (20, 3), (40, 2)Volatility channels
Momentum IndicatorsCCI, CTI, Williams %R (14, 32, 64, 96, 480)Momentum extremes
Volume IndicatorsCMF, MFI, Volume MeanVolume-price analysis
Composite IndicatorsEWO (Elliott Wave Oscillator), PMAX, T3Trend 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

  1. Rich Signals: 40 buy conditions cover multiple market scenarios
  2. Clear Code: Compared to MOD version, code structure is more concise
  3. Trailing Profit-Taking: Automatically takes profit when price pulls back from highs
  4. Slippage Protection: Entry confirmation mechanism prevents excessive slippage
  5. Multi-timeframe Confirmation: Uses 1h and 15m timeframes to filter false signals

⚠️ Limitations

  1. Many Parameters: Many optimizable parameters, requires tuning experience
  2. Computationally Intensive: Multi-timeframe and multi-indicator calculations have hardware requirements
  3. Tight Stop Loss: 10% fixed stop loss may stop out too early during violent volatility
  4. Not Suitable for Chasing Highs: Strategy偏向 bottom-fishing, misses strong upward trends

VIII. Applicable Scenario Recommendations

Market EnvironmentRecommended ConfigurationDescription
Slow Bull TrendDefault configurationTrend pullback signals perform excellently
Wide OscillationEnable more pullback signalsBollinger Band pullback signals work well
Post-Crash ReboundEnable NFI seriesDeep pullback signals capture rebounds
Rapid RiseUse with cautionStrategy偏向 bottom-fishing, may miss opportunities
Single-sided BearReduce trading frequencyMany 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 TypePerformance RatingReason 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 ItemRecommended ValueDescription
Stop Loss-0.10As final safety net, can adjust based on risk preference
Minimum ROI0.005Minimum profit target
Slippage Threshold0.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 PairsMinimum RAMRecommended RAM
1-10 pairs4GB8GB
10-30 pairs8GB16GB
30+ pairs16GB32GB

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:

  1. Focus on Bollinger Band lower band 2-3 standard deviation prices
  2. Watch for RSI below 30
  3. Seek pullback opportunities above EMA 200
  4. 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:

  1. Signal Diversity: Covers multiple entry scenarios including pullback, breakout, and oscillation
  2. Trailing Profit-Taking: Automatically locks in profits when price pulls back
  3. Dynamic Stop Loss: Automatically adjusts risk exposure as profit changes
  4. 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