MACD exit % indicator
May 29, 2020

The MACD exit % indicator tool provides a specialized approach for determining optimal exit points based on the percentage decay of the Moving Average Convergence Divergence (MACD) histogram from its peak. By monitoring the momentum exhaustion after a histogram flip, it helps traders identify when a trend might be losing steam before a full crossover occurs.
Usage
The tool is designed to supplement standard MACD strategies by providing an early warning system for trend reversals or pullbacks.
- Identifying Peaks: The script tracks the maximum absolute value of the histogram since the last zero-line crossover (flip).
- Triggering Exits: When the current histogram value retraces by a user-defined percentage from that peak, an exit region is highlighted on the chart.
- Visual Cues:
- Aqua Background: Marks the point where the MACD histogram flips (crosses the zero line).
- Fuchsia Background: Indicates the bar where the maximum absolute histogram value was achieved for the current trend.
- Orange/Yellow Background: Highlights the "Exit" region where the histogram has decayed beyond the specified percentage threshold.
Details
This script calculates the standard MACD line, Signal line, and Histogram using fast, slow, and signal smoothing lengths. Unlike traditional MACD strategies that wait for a signal line crossover or a zero-line cross to exit, this indicator looks at the "internal" momentum of the histogram.
The logic calculates the percentage difference between the maxHist (the highest/lowest point since the trend started) and the currentHist. If (1 - math.abs(currentHist / maxHist)) * 100 exceeds the MACD max% exit input, it signals that the current momentum has significantly faded from its peak, suggesting a potential exit point to preserve gains.
Settings
- MACD fast length: The period for the shorter-term exponential moving average (default is 12).
- MACD slow length: The period for the longer-term exponential moving average (default is 26).
- Signal smoothing: The period for the EMA of the MACD line (default is 9).
- MACD max% exit: The percentage threshold of histogram decay required to trigger an exit signal (default is 70%).
FAQ
How do I access the MACD exit % indicator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can I use this for entry signals?
While primarily designed as an exit tool to identify momentum exhaustion, some traders may use the decay from a peak as a counter-trend signal, though its main value lies in trade management.
Why does the exit signal disappear sometimes?
The exit condition is calculated bar-by-bar based on the current peak. If the histogram makes a new higher high (or lower low for shorts), the percentage decay is reset relative to that new peak.
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.