MACD_BB_2 Strategy Analysis
Strategy ID: #231 (Strategy #231 of 465)
Strategy Type: MACD + Bollinger Bands Dual-Indicator Combination
Timeframe: 15 Minutes (15m)
I. Strategy Overview
MACD_BB_2 is the second variant of the MACD_BB strategy, combining two classic technical indicators: MACD (Moving Average Convergence Divergence) and Bollinger Bands. This strategy inherits the dual-indicator confirmation logic of MACD_BB, with potential optimizations in certain details.
The "BB" in the strategy name stands for Bollinger Bands, and the "2" indicates this is the second version, which may differ from the first in indicator parameters or condition logic.
Core Characteristics
| Characteristic | Description |
|---|---|
| Buy Conditions | 2 sets of MACD + Bollinger Bands entry signals |
| Sell Conditions | 1 set of base sell signals + tiered take-profit |
| Protection | 1 set of buy protection (MACD trend filter + Bollinger Band position filter) |
| Timeframe | 15-minute primary timeframe |
| Dependencies | pandas, numpy, TA-Lib |
II. Strategy Configuration Analysis
2.1 Basic Risk Parameters
# ROI Exit Table
minimal_roi = {
"0": 0.08,
"30": 0.05,
"60": 0.02,
"120": 0
}
# Stoploss Settings
stoploss = -0.10
# Trailing Stop
trailing_stop = True
trailing_stop_positive = 0.025
trailing_stop_positive_offset = 0.03
Design Philosophy:
- Time-Decreasing Take-Profit: The longer the holding period, the lower the profit target — embodying the concept of "letting profits run"
- Short-Term High Returns: Exit if 8% profit is achieved within 0–30 minutes
- Strict Stoploss: -10% hard stop controls maximum loss per trade
2.2 Order Type Configuration
Uses Freqtrade default order type configuration.
III. Entry Conditions Details
3.1 MACD Indicator Analysis
MACD provides trend and momentum signals:
- MACD Line: 12-period EMA - 26-period EMA
- Signal Line: 9-period EMA of MACD Line
- Golden Cross: MACD Line crosses above Signal Line — buy signal
- Death Cross: Signal Line crosses above MACD Line — sell signal
3.2 Bollinger Bands Indicator Analysis
Bollinger Bands provide overbought/oversold and price position information:
- Upper Band: Middle Band + 2 × Standard Deviation
- Middle Band: 20-period Simple Moving Average
- Lower Band: Middle Band - 2 × Standard Deviation
3.3 Entry Conditions Details
Condition #1: MACD Golden Cross + Bollinger Band Middle Band Support
Logic:
- MACD generates a golden cross signal (momentum strengthening)
- Price is near the Bollinger Band middle band (not in overbought territory)
Code Logic:
# MACD golden cross
macd_crossed_above = qtpylib.crossed_above(dataframe["macd"], dataframe["macdsignal"])
# Price above Bollinger middle band
price_above_mid = dataframe["close"] > dataframe["bb_middle"]
Condition #2: Bollinger Band Lower Band Bounce + MACD Momentum Turning Positive
Logic:
- Price touches or approaches the Bollinger Band lower band (oversold)
- MACD histogram starts turning positive (momentum recovering)
Code Logic:
# Price near lower Bollinger Band
near_lower_bb = dataframe["close"] <= dataframe["bb_lower"] * 1.02
# MACD momentum turning positive
macd_momentum = dataframe["macd"] > dataframe["macd"].shift(1)
IV. Exit Conditions Details
4.1 Tiered Take-Profit System
| Holding Time | Minimum Profit Rate | Trigger Condition |
|---|---|---|
| 0–30 minutes | 8% | Short-term quick profit |
| 30–60 minutes | 5% | Medium-term target |
| 60–120 minutes | 2% | Long-term target |
| After 120 minutes | 0% | Breakeven exit |
4.2 Base Sell Signals
Sell Conditions:
- MACD death cross (momentum weakening)
- Price touches Bollinger Band upper band (overbought)
4.3 Stoploss Mechanism
| Type | Parameter | Description |
|---|---|---|
| Hard Stoploss | -10% | Forced exit at 10% loss |
| Trailing Stop | +2.5% | Activates protection when profit drawdown reaches 2.5% |
V. Technical Indicator System
5.1 Core Indicators
| Indicator Category | Specific Indicator | Parameters | Purpose |
|---|---|---|---|
| Trend Indicator | MACD | 12/26/9 | Trend direction and momentum |
| Volatility Indicator | Bollinger Bands | 20, 2 | Overbought/oversold identification |
5.2 MACD Indicator Details
Calculation Formula:
- MACD Line = EMA(12) - EMA(26)
- Signal Line = EMA(MACD Line, 9)
- Histogram = MACD Line - Signal Line
Trading Signals:
- Golden Cross: MACD Line crosses above Signal Line → Buy
- Death Cross: Signal Line crosses above MACD Line → Sell
5.3 Bollinger Bands Indicator Details
Calculation Formula:
- Middle Band = SMA(20)
- Upper Band = Middle Band + 2 × STD(20)
- Lower Band = Middle Band - 2 × STD(20)
Trading Applications:
- Price touches upper band: Overbought signal, potential pullback
- Price touches lower band: Oversold signal, potential rebound
- Bollinger Bands narrow: Volatility decreasing, potential breakout
VI. Risk Management Highlights
6.1 Hard Stoploss
stoploss = -0.10 # -10%
Description: Maximum loss per trade is controlled within 10%.
6.2 Trailing Stop
trailing_stop_positive = 0.025
trailing_stop_positive_offset = 0.03
Description:
- Activates trailing stop after profit reaches 3%
- Triggers exit on 2.5% drawdown from peak
6.3 Time-Decreasing ROI
| Time Period | Take-Profit Target | Strategy Logic |
|---|---|---|
| 0–30 min | 8% | Quick profit |
| 30–60 min | 5% | Medium-term target |
| 60–120 min | 2% | Conservative target |
| 120 min+ | 0% | Breakeven exit |
VII. Strategy Pros & Cons
Pros
- Classic Combination: Two most widely-used technical indicators, well-validated
- Strong Complementarity: MACD handles trend, Bollinger Bands handle position
- Clear Signals: Dual confirmation reduces false signals
- Broad Applicability: Usable across multiple markets and timeframes
Cons
- Indicator Lag: Both MACD and Bollinger Bands have some lag
- Average Performance in Ranging Markets: May generate false signals in consolidation
- Parameter Sensitivity: Requires market-specific parameter adjustment
- No Trend Filter: Lacks long-term trend indicator (e.g., EMA200) confirmation
VIII. Applicable Scenarios
| Market Environment | Recommended Config | Description |
|---|---|---|
| Uptrend | Enable | MACD confirms direction, Bollinger Bands finds pullback entries |
| Downtrend | Enable | Equally effective for shorting |
| Ranging Market | Reduce trades | Bollinger Bands overbought/oversold signals dominate |
| High Volatility | Adjust stoploss | May need to widen to -12% |
| Low Volatility | Adjust ROI | Lower take-profit targets for narrow ranges |
IX. Applicable Market Environment Details
MACD_BB_2 is a typical dual-indicator combination strategy, blending trend-following (MACD) and mean-reversion (Bollinger Bands) approaches.
9.1 Strategy Core Logic
- MACD Golden Cross: Momentum strengthening, confirms uptrend
- Bollinger Band Support: Price at favorable position, not chasing
- Dual Confirmation: Buy only when both indicators are satisfied, improving signal quality
9.2 Performance Across Market Environments
| Market Type | Performance Rating | Analysis |
|---|---|---|
| Uptrend | ★★★★☆ | MACD confirms correct direction, Bollinger Bands finds low-risk entries |
| Downtrend | ★★★★☆ | Usable for shorting strategies |
| Wide Range | ★★★☆☆ | Bollinger Bands overbought/oversold signals effective |
| Extreme Consolidation | ★★☆☆☆ | Too little volatility, fewer signals |
9.3 Key Configuration Recommendations
| Config Item | Recommended Value | Description |
|---|---|---|
| Number of Pairs | 15–30 | Moderate signal frequency |
| Max Open Trades | 2–4 | Risk control |
| Timeframe | 15m | Balances signal quality and frequency |
X. Summary
MACD_BB_2 is the second variant of the MACD_BB strategy. Its core value lies in:
- Classic Combination: MACD + Bollinger Bands, dual confirmation
- Trend + Position: MACD judges direction, Bollinger Bands judges position
- Strict Risk Control: -10% stoploss + trailing stop
- Tiered Take-Profit: Let profits run, lock in gains promptly
Recommendations for quantitative traders:
- Understand the complementary relationship between the two indicators
- Consider adding long-term trend filters (e.g., EMA200) as enhancements
- Adjust take-profit/stoploss parameters for different markets
- Watch out for false signals in ranging markets