Skip to main content

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

CharacteristicDescription
Buy Conditions2 sets of MACD + Bollinger Bands entry signals
Sell Conditions1 set of base sell signals + tiered take-profit
Protection1 set of buy protection (MACD trend filter + Bollinger Band position filter)
Timeframe15-minute primary timeframe
Dependenciespandas, 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 TimeMinimum Profit RateTrigger Condition
0–30 minutes8%Short-term quick profit
30–60 minutes5%Medium-term target
60–120 minutes2%Long-term target
After 120 minutes0%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

TypeParameterDescription
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 CategorySpecific IndicatorParametersPurpose
Trend IndicatorMACD12/26/9Trend direction and momentum
Volatility IndicatorBollinger Bands20, 2Overbought/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 PeriodTake-Profit TargetStrategy Logic
0–30 min8%Quick profit
30–60 min5%Medium-term target
60–120 min2%Conservative target
120 min+0%Breakeven exit

VII. Strategy Pros & Cons

Pros

  1. Classic Combination: Two most widely-used technical indicators, well-validated
  2. Strong Complementarity: MACD handles trend, Bollinger Bands handle position
  3. Clear Signals: Dual confirmation reduces false signals
  4. Broad Applicability: Usable across multiple markets and timeframes

Cons

  1. Indicator Lag: Both MACD and Bollinger Bands have some lag
  2. Average Performance in Ranging Markets: May generate false signals in consolidation
  3. Parameter Sensitivity: Requires market-specific parameter adjustment
  4. No Trend Filter: Lacks long-term trend indicator (e.g., EMA200) confirmation

VIII. Applicable Scenarios

Market EnvironmentRecommended ConfigDescription
UptrendEnableMACD confirms direction, Bollinger Bands finds pullback entries
DowntrendEnableEqually effective for shorting
Ranging MarketReduce tradesBollinger Bands overbought/oversold signals dominate
High VolatilityAdjust stoplossMay need to widen to -12%
Low VolatilityAdjust ROILower 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 TypePerformance RatingAnalysis
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 ItemRecommended ValueDescription
Number of Pairs15–30Moderate signal frequency
Max Open Trades2–4Risk control
Timeframe15mBalances signal quality and frequency

X. Summary

MACD_BB_2 is the second variant of the MACD_BB strategy. Its core value lies in:

  1. Classic Combination: MACD + Bollinger Bands, dual confirmation
  2. Trend + Position: MACD judges direction, Bollinger Bands judges position
  3. Strict Risk Control: -10% stoploss + trailing stop
  4. 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