MACD histogram divergence v1
Oct 7, 2019

The MACD histogram divergence v1 tool identifies potential trend reversal and continuation points by detecting regular divergences between price action and the MACD histogram. It aims to provide intraday traders with actionable signals when momentum shifts, supplemented by RSI and EMA-based trend filtering.
Usage
The tool is primarily used to identify entry points based on momentum exhaustion.
- Long Signals (L): Appear when the price makes a lower low but the MACD histogram makes a higher low, suggesting a bullish reversal or trend continuation.
- Short Signals (S): Appear when the price makes a higher high but the MACD histogram makes a lower high, suggesting a bearish reversal or trend continuation.
- Trend Filtering: The script includes background coloring based on the 200 EMA and RSI. A green background suggests a potential long opportunity when RSI is oversold (<30) and price is above the 200 EMA. A red background suggests a potential short opportunity when RSI is overbought (>70) and price is below the 200 EMA.
Traders often use these signals in conjunction with horizontal Support and Resistance (S/R) levels for higher probability trade setups.
Details
The script calculates the MACD histogram using customizable fast and slow lengths. It then scans a lookback range (defined in the code as 100 bars) to find local peaks and troughs in both price and the histogram. A "Regular Divergence" is confirmed when the price direction and momentum direction disagree at these pivot points.
Furthermore, the script integrates a 200-period Exponential Moving Average (EMA) and a 14-period Relative Strength Index (RSI) to provide context. These filters help traders avoid counter-trend signals or identify areas where the market is statistically overextended.
Settings
- Simple MA(Oscillator): Toggle between using a Simple Moving Average (SMA) or Exponential Moving Average (EMA) for the fast and slow components of the MACD.
- Simple MA(Signal Line): Toggle between SMA and EMA for the signal line smoothing.
- Source hist: Determines the price source used for the histogram calculations (e.g., Close, OHLC4).
- Fast Length: The period for the fast moving average calculation.
- Slow Length: The period for the slow moving average calculation.
- Signal Smoothing: The period used to smooth the MACD line to create the signal line.
FAQ
How do I access MACD histogram divergence v1?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can I use this indicator for scalping?
Yes, the script is designed for intraday trading, but it is recommended to use it alongside other technical analysis tools like S/R levels or volume profile.
What do the background colors represent?
The background colors indicate a confluence of trend (200 EMA) and momentum (RSI). Green indicates a potential bullish context (price > 200 EMA and RSI < 30), while red indicates a potential bearish context (price < 200 EMA and RSI > 70).
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.