Strategy MACD vs BB
Dec 13, 2019

The Strategy MACD vs BB tool combines trend-following and mean reversion principles by applying Bollinger Bands directly to a MACD signal to identify overextended price movements and potential pullbacks.
Usage
The Strategy MACD vs BB is used to identify entry points based on the MACD's interaction with volatility bands. Unlike standard breakout strategies, this tool focuses on pullbacks from extreme levels.
- Long Positions: A long signal is generated when the MACD line crosses back above the lower Bollinger Band, suggesting a recovery from an oversold state within the MACD range.
- Short Positions: A short signal is generated when the MACD line crosses back below the upper Bollinger Band, suggesting a reversal from an overbought state.
The indicator plots the MACD line alongside a basis (middle) line and the upper/lower bands. Background fills are utilized to highlight when the MACD is in "support" (below lower band) or "resistance" (above upper band) zones.
Details
The strategy calculates a custom MACD value using a user-selected Moving Average type (SMA, EMA, WMA, or Linear Regression). Once the MACD line is derived, standard Bollinger Band calculations (Standard Deviation and Simple Moving Average) are applied to the MACD series itself rather than the price.
This transformation allows traders to view momentum through the lens of volatility. By identifying when the MACD line exceeds its typical range, the script highlights statistical extremes. The strategy enters a trade only when the MACD returns inside the bands, acting as a filter to ensure the momentum is beginning to shift back toward the mean.
Settings
MACD & MA Settings
- Fast MA period: Sets the length for the faster moving average used in the MACD calculation.
- Slow MA period: Sets the length for the slower moving average used in the MACD calculation.
- Source: The price data source used for calculations (e.g., Close, Open, HL2).
- Moving Average Calculation: Selects the algorithm used for the MAs: (1) SMA, (2) EMA, (3) WMA, or (4) Linear Regression.
Bollinger Bands Settings
- Length: The lookback period for the Bollinger Band basis (SMA) and Standard Deviation.
- BB multiplier: The number of standard deviations used to determine the width of the upper and lower bands.
FAQ
How do I use Strategy MACD vs BB?
You can use the signals generated when the MACD line re-enters the Bollinger Bands to identify potential mean-reversion opportunities or trend pullbacks.
Can I change the type of Moving Average used?
Yes, the script allows you to choose between four different types: Simple (SMA), Exponential (EMA), Weighted (WMA), and Linear Regression (LinReg) to suit different market conditions.
How can I access Strategy MACD vs BB?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.