MACD Objective Breakouts + Alerts
Jan 23, 2022

The MACD Objective Breakouts + Alerts indicator identifies dynamic support and resistance levels based on MACD histogram peaks and troughs to highlight high-probability breakout opportunities. By anchoring price levels to momentum shifts, the tool provides an objective framework for detecting trend continuations and reversals.
Usage
The tool can be used to identify key breakout points when price action exceeds historical levels established during the previous MACD cycle. When the MACD histogram is positive, the script tracks the maximum price reached; when it crosses below the signal line, a horizontal resistance level is set. Conversely, when the MACD is negative, the script tracks the minimum price to set a support level.
Breakouts are visualized with shapes:
- Diamonds: Represent the first breakout of a newly established level.
- Triangles: Indicate subsequent bars closing beyond the level, suggesting momentum persistence.
Users can also utilize the built-in divergence detection to filter for higher-quality breakouts. For instance, a bullish breakout occurring after a bullish divergence may signal a stronger reversal than a standard breakout.
Details
The script functions by partitioning price action into "MACD phases" determined by the relationship between the MACD line and the Signal line. During a bullish phase (MACD > Signal), the script monitors the high prices. Once a crossunder occurs, the highest price of that specific phase is locked in as an objective resistance line. This ensures that the levels plotted are always relevant to the most recent momentum cycle.
The indicator also calculates Regular and Hidden Divergences by comparing the price at these objective levels to the corresponding MACD histogram values.
Settings
MACD Settings
- Regular Divergence Detection: Enables checking for regular bullish and bearish divergence based on detected levels.
- Hidden Divergence Detection: Enables checking for hidden bullish and bearish divergence.
- Minimum Histogram Bars: Requires the histogram to maintain its color for a minimum number of bars before a level is confirmed.
- Fast/Slow/Signal Length: Standard MACD parameters for calculating the fast EMA, slow EMA, and signal smoothing.
- MACD/Signal MA Type: Allows selecting between SMA, EMA, WMA, or VWMA for the calculations.
- Source: The price input used for MACD calculations (default is Close).
Alert Settings
- Only On Close Outside of Level: Triggers alerts only when a candle closes beyond a level rather than a simple touch.
- Only First Breakout Candle: Restricts alerts to the initial break of a level to reduce noise.
- Only Divergence Breakouts: Filters breakout alerts to only trigger if a divergence was recently detected.
- Long/Short Breakouts: Toggles for specific breakout direction alerts and custom message fields.
Style Settings
- Plot Shapes On Breakouts: Toggles the diamond and triangle visual markers.
- Plot Lines at Key Levels: Toggles the horizontal support and resistance lines.
- Upper/Lower Line Color & Width: Customization options for the level visuals.
FAQ
How do I access MACD Objective Breakouts + Alerts?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
How are the breakout levels calculated?
Levels are derived from the highest high or lowest low achieved during the most recent completed MACD histogram cycle.
Why did a breakout occur without a shape appearing?
Ensure that "Plot Shapes On Breakouts" is enabled in the Style settings and that the "Minimum Histogram Bars" requirement has been met for the level to be valid.
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.