BB_Strategy04 Strategy In-Depth Analysis
Strategy Number: #454 (454th out of 465 strategies)
Strategy Type: Double Standard Deviation Bollinger Bands Breakout Strategy
Timeframe: 1 hour (1h)
1. Strategy Overview
BB_Strategy04 is a breakout strategy based on double standard deviation Bollinger Bands. The strategy uses 72-period (approximately 3 days) Bollinger Bands, simultaneously calculating 1 standard deviation and 2 standard deviation channels, buying when price touches near the 2 standard deviation lower band, and selling when price breaks through the 2 standard deviation upper band.
Core Features
| Feature | Description |
|---|---|
| Buy Conditions | 1 independent buy signal (Near 2 std dev lower band) |
| Sell Conditions | 1 base sell signal (2 std dev upper band breakout) |
| Protection Mechanisms | Loose stoploss (-32.5%) + Trailing stoploss |
| Timeframe | 1 hour |
| Dependencies | talib, qtpylib, numpy, pandas |
2. Strategy Configuration Analysis
2.1 Base Risk Parameters
# ROI exit table
minimal_roi = {
"0": 0.22597784040439192, # Immediate 22.6% profit
"180": 0.06269048445164815, # 6.27% profit after 180 minutes
"613": 0.037662786960331776, # 3.77% profit after 613 minutes
"2004": 0 # Break-even exit after 2004 minutes
}
# Stoploss settings
stoploss = -0.32530922906811843 # Fixed stoploss -32.5%
# Trailing stoploss
trailing_stop = True
# trailing_only_offset_is_reached = False # Not configured
# trailing_stop_positive = 0.01 # Not configured
# trailing_stop_positive_offset = 0.0 # Not configured
Design Rationale:
- ROI table parameters are precise to multiple decimal places, obviously经过 hyperparameter optimization
- Fixed stoploss around 32.5%, extremely loose, allows significant drawdown
- Trailing stoploss enabled but parameters not finely configured
2.2 Order Type Configuration
order_types = {
'buy': 'limit', # Limit buy
'sell': 'limit', # Limit sell
'stoploss': 'market', # Market stoploss
'stoploss_on_exchange': False
}
order_time_in_force = {
'buy': 'gtc', # Good Till Cancelled
'sell': 'gtc'
}
3. Buy Conditions Explained
3.1 Single Buy Condition
The strategy employs a simple single-condition buy logic:
dataframe.loc[
(
(dataframe['close'] < dataframe['bb_lowerband2']) # Close below 2 std dev lower band
&
(dataframe['close'] > dataframe['bb_lowerband2'] * (1 + self.stoploss)) # But not below stoploss position
),
'buy'] = 1
Logic Breakdown:
| Condition | Meaning | Design Intent |
|---|---|---|
close < bb_lowerband2 | Price breaks below 2 std dev lower band | Capture extreme oversold opportunities |
close > bb_lowerband2 * (1 + stoploss) | Price not below lower band × (1 - 32.5%) | Avoid entering during extreme crashes |
Buy Zone Illustration:
Price Position Illustration:
bb_upperband2 ← 2σ Upper Band
─────────────────
bb_upperband1 ← 1σ Upper Band
─────────────────
bb_middleband ← Middle Band
─────────────────
bb_lowerband1 ← 1σ Lower Band
─────────────────
bb_lowerband2 ← 2σ Lower Band
│
│ ★ Buy Zone
│ (Price below 2σ lower band but above lower band × 67.5%)
│
✗ Do Not Buy (Decline exceeds stoploss line)
3.2 Bollinger Bands Parameters
# Bollinger Bands parameters
window = 24 * 3 # 72 periods (approximately 3 days, for 1h timeframe)
stds = [1, 2] # Calculate 1 std dev and 2 std dev
Parameter Interpretation:
- 72 periods: Approximately 3 days of data, filters short-term noise
- Double Standard Deviation: 1σ for visual reference, 2σ for trading signals
- Uses Close Price: Not typical price, simplifies calculation
4. Sell Logic Explained
4.1 Single Sell Signal
dataframe.loc[
(
(dataframe['close'] > dataframe['bb_upperband2']) # Close above 2 std dev upper band
),
'sell'] = 1
Logic Interpretation:
| Condition | Meaning | Design Intent |
|---|---|---|
close > bb_upperband2 | Price breaks above 2 std dev upper band | Capture exit opportunity after extreme overbought |
4.2 ROI Time Decay Mechanism
| Holding Time | Target Return | Notes |
|---|---|---|
| 0 minutes | 22.60% | High return target immediately after opening |
| 180 minutes (3 hours) | 6.27% | Reduce return expectations |
| 613 minutes (~10.2 hours) | 3.77% | Continue reducing |
| 2004 minutes (~33.4 hours) | 0% | Break-even exit |
Design Intent: Stepwise reduction of profit targets, avoids long-term holding.
4.3 Multi-Layer Exit Mechanism
Exit Priority: ROI → Trailing Stoploss → Fixed Stoploss → Signal Sell
1. ROI Exit: Decreasing profit targets based on holding time
2. Trailing Stoploss: Enabled but default parameters
3. Fixed Stoploss: Forced exit when loss exceeds 32.5%
4. Signal Sell: Price breaks above 2σ upper band
5. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Parameters | Usage |
|---|---|---|---|
| Trend Indicator | Bollinger Bands (BB) - 1σ | 72 periods, 1 std dev | Visual reference |
| Trend Indicator | Bollinger Bands (BB) - 2σ | 72 periods, 2 std dev | Trading signals |
| Momentum Indicator | Relative Strength Index (RSI) | Default 14 periods | Calculated (not used for signals) |
5.2 Indicator Calculation Code
# RSI calculation (calculated but not used for signals)
dataframe['rsi'] = ta.RSI(dataframe)
# Double standard deviation Bollinger Bands calculation
for std in [1, 2]:
bollinger = qtpylib.bollinger_bands(
dataframe['close'],
window=24*3, # 72 periods
stds=std
)
dataframe[f'bb_lowerband{std}'] = bollinger['lower']
dataframe[f'bb_middleband{std}'] = bollinger['mid']
dataframe[f'bb_upperband{std}'] = bollinger['upper']
5.3 Visualization Configuration
plot_config = {
'main_plot': {
'bb_lowerband2': {'color': 'red'}, # 2σ lower band - red
'bb_lowerband1': {'color': 'green'}, # 1σ lower band - green
'bb_middleband1': {'color': 'orange'}, # Middle band - orange
'bb_upperband1': {'color': 'green'}, # 1σ upper band - green
}
}
6. Risk Management Features
6.1 Extremely Loose Stoploss Settings
The strategy employs a fixed stoploss of approximately 32.5%, which is an extremely loose setting:
| Risk Control Type | Parameter | Description |
|---|---|---|
| Fixed Stoploss | -32.5% | Allows significant drawdown |
| Trailing Stoploss | Enabled | Parameters not finely configured |
Risk Assessment:
- Advantage: Gives the strategy ample "breathing room", won't be shaken out by short-term volatility
- Risk: Single-trade loss can be extremely large, requires strict position management
6.2 ROI Parameter Characteristics
ROI table parameters are precise to 8-14 decimal places, indicating fine hyperparameter optimization:
"0": 0.22597784040439192 # Precise to 14 decimal places
"180": 0.06269048445164815 # Precise to 14 decimal places
"613": 0.037662786960331776 # Precise to 15 decimal places
Over-optimization Risk: Such precise parameters may be overfitting to historical data, live trading performance may differ significantly from backtesting.
6.3 Buy Protection Mechanism
dataframe['close'] > dataframe['bb_lowerband2'] * (1 + self.stoploss)
The actual meaning of this condition:
1 + stoploss = 1 + (-0.325) = 0.675- That is: Price not below 67.5% of lower band
- This is a "decline protection", avoids entering during extreme crashes
7. Strategy Strengths and Limitations
✅ Strengths
- Double Standard Deviation Channels: 2σ channels capture extreme deviations better than 1σ
- Loose Stoploss: Allows significant drawdown, won't be shaken out by normal volatility
- Long-period Bollinger Bands: 72 periods filters short-term noise
- Simple Logic: Single buy/sell conditions, easy to understand and maintain
- Buy Protection: Avoids entering during extreme crashes
⚠️ Limitations
- Suspected Over-optimization: ROI parameters precise to multiple decimal places, may be overfitted
- Stoploss Too Wide: 32.5% stoploss may lead to huge single-trade losses
- RSI Not Used: RSI is calculated but not used for trading signals
- Trailing Stoploss Not Configured: Enabled but default parameters, not finely tuned
- No Trend Filter: Does not judge major trend direction
8. Applicable Scenario Recommendations
| Market Environment | Recommended Configuration | Description |
|---|---|---|
| Range-bound Market | Default configuration | Strategy's original design |
| Slow Bull Market | Lower stoploss | Can appropriately tighten stoploss |
| Sharp Decline | Use with caution | Wide stoploss may承受 large losses |
| High Volatility | Adjust Bollinger Bands parameters | May need wider channels |
9. Applicable Market Environments Explained
BB_Strategy04 is an extreme mean reversion strategy. Using 2 standard deviation Bollinger Bands means it only enters when price shows extreme deviations. It is best suited for volatile range-bound markets and performs poorly in single-sided trend markets.
9.1 Strategy Core Logic
- Extreme Deviation Capture: 2σ deviation means approximately 95% of prices fall within the channel, breaking 2σ is a low-probability event
- Mean Reversion Expectation: Price tends to回归 mean after extreme deviations
- Loose Stoploss: Gives strategy sufficient time to wait for regression
9.2 Performance in Different Market Environments
| Market Type | Performance Rating | Reason Analysis |
|---|---|---|
| 📈 Slow Bull Market | ⭐⭐☆☆☆ | May sell too early, miss gains |
| 🔄 Range-bound Market | ⭐⭐⭐⭐⭐ | Best application scenario, captures extreme deviations |
| 📉 Sharp Decline Market | ⭐☆☆☆☆ | Stoploss too wide, may承受 huge losses |
| ⚡️ Single-sided Trend | ⭐☆☆☆☆ | Counter-trend operations carry extreme risk |
9.3 Key Configuration Recommendations
| Configuration Item | Recommended Value | Description |
|---|---|---|
| Stoploss | -15% ~ -20% | Current setting too wide, recommend tightening |
| Timeframe | 1h | Keep default |
| Position | Small position | Wide stoploss risk is high, need position control |
10. Important Reminders: The Cost of Complexity
10.1 Learning Curve
The strategy logic is relatively simple, but understanding the statistical meaning of 2 standard deviation Bollinger Bands requires some foundation:
- Understand normal distribution and standard deviation
- Master the meaning of Bollinger Band channels
- Understand the risks of mean reversion strategies
10.2 Hardware Requirements
| Number of Trading Pairs | Minimum RAM | Recommended RAM |
|---|---|---|
| 1-10 pairs | 1GB | 2GB |
| 10-50 pairs | 2GB | 4GB |
Strategy computational requirements are low.
10.3 Differences Between Backtesting and Live Trading
Over-optimization Risk:
- ROI parameters precise to 14 decimal places
- Obviously the result of hyperparameter optimization
- Live trading performance may differ significantly from backtesting
Recommendations:
- Evaluate backtest results at 50-70% of reported performance
- Test live trading with extremely small positions first
- Consider simplifying ROI parameters
10.4 Recommendations for Manual Traders
If manually referencing this strategy:
- Bollinger Bands parameters: 72 periods, 2 std dev
- Buy condition: Price breaks below 2σ lower band
- Sell condition: Price breaks above 2σ upper band
- Stoploss: Recommend setting more reasonable stoploss (e.g., 15-20%)
11. Summary
BB_Strategy04 is a double standard deviation Bollinger Bands mean reversion strategy. Its core value lies in:
- Extreme Deviation Capture: Uses 2σ channels to capture extreme oversold/overbought
- Loose Stoploss: Gives strategy ample drawdown space
- Long-period Filtering: 72 periods filters short-term noise
For quantitative traders, this is a strategy that requires cautious use:
- ROI parameter over-optimization risk is relatively high
- 32.5% stoploss is too loose, recommend adjustment
- Suitable for volatile range-bound markets