MACD with alert
Mar 27, 2019

The MACD with alert indicator provides a comprehensive toolkit for monitoring trend momentum through the Moving Average Convergence Divergence (MACD) oscillator, featuring integrated alerts for crossovers and histogram shifts. This tool aims to help traders identify trend reversals and momentum changes by visualizing standard MACD components with enhanced alert capabilities.
Usage
The indicator can be used to identify trend momentum and potential entry or exit points based on the relationship between the MACD line, signal line, and histogram.
- Golden/Death Crosses: A Golden Cross (GC) occurs when the MACD line crosses above the signal line, suggesting bullish momentum. Conversely, a Death Cross (DC) occurs when the MACD line crosses below the signal line, suggesting bearish momentum. These points are highlighted on the MACD line with circles for easy identification.
- Histogram Color Changes: The histogram changes color based on whether momentum is increasing or decreasing relative to the zero line. Darker colors typically represent strong trending momentum (increasing above zero or decreasing below zero), while lighter colors suggest waning momentum.
- Momentum Alerts: Users can set alerts for specific conditions such as GC/DC events or histogram color changes (increases/decreases). This allows for proactive monitoring without needing to watch the chart constantly.
Details
The script calculates the MACD line using the difference between a short-term EMA and a long-term EMA. A signal line is then derived from an EMA of the MACD line itself. The histogram represents the difference between the MACD line and the signal line.
The implementation includes logic to detect four specific histogram states:
- histUpPlus: Positive histogram value and increasing.
- histDownPlus: Positive histogram value and decreasing.
- histUpMinus: Negative histogram value and increasing.
- histDownMinus: Negative histogram value and decreasing.
Settings
- Source: Determines the price data used for the MACD calculation (e.g., Close, Open, High, Low).
- Short EMA length: The period used for the faster exponential moving average.
- Long EMA length: The period used for the slower exponential moving average.
- Signal length: The period used for the EMA of the MACD line.
- Check histogram alert points: A toggle to display visual markers (asterisks) on the chart where histogram increase or decrease alerts would trigger.
FAQ
How do I access MACD with alert?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What is the difference between a histogram increase and a Golden Cross?
A histogram increase refers to the momentum of the MACD becoming more positive (or less negative), which often precedes a Golden Cross. A Golden Cross specifically requires the MACD line to cross above the signal line.
Can I set alerts for only bearish crosses?
Yes, the script includes specific alert conditions for Death Crosses (DC) and histogram decreases, allowing you to filter for bearish signals only.
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.