MACD
Sep 5, 2019

The MACD [Gu5] indicator provides a visually enhanced representation of the classic Moving Average Convergence Divergence oscillator to help traders identify trend changes and momentum shifts.
Usage
The indicator can be used to identify trend momentum and potential reversals through the interaction of the MACD line, Signal line, and Histogram. A key feature is the "Cross Line" visualization, which highlights crossovers with distinct circular markers on the signal line for better visibility of entry or exit points.
Users can adapt the indicator for different market conditions:
- Volatile Markets (e.g., BTC): Recommended settings include a Fast Length of 21, Slow Length of 55, and Signal Smoothing of 14 to filter out noise.
- Standard Markets: Traditional settings like 12, 26, and 9 can be used for more sensitive tracking of price movements.
Details
The script calculates the difference between two moving averages (Fast and Slow) to create the MACD line. A Signal line is then derived from the MACD line using a specified smoothing period. The histogram represents the difference between the MACD and Signal lines, with color-coding to indicate whether momentum is increasing or decreasing above or below the zero line. This version allows users to toggle between Exponential Moving Averages (EMA) and Simple Moving Averages (SMA) for both the oscillator and the signal smoothing.
Settings
- Fast Length: The period for the shorter moving average.
- Slow Length: The period for the longer moving average.
- Source: The price data used for calculations (default is Close).
- Signal Smoothing: The period used to calculate the Signal line from the MACD line.
- Simple MA(Oscillator) On/Off: Toggles between SMA and EMA for the Fast and Slow moving averages.
- Simple MA(Signal) On/Off: Toggles between SMA and EMA for the Signal line calculation.
- Alert On/Off: Enables or disables the visual markers for crossovers on the chart.
FAQ
How do I use the MACD [Gu5] for trend identification?
You can look for crossovers between the MACD and Signal lines; a crossover above the signal line suggests bullish momentum, while a crossunder suggests bearish momentum.
Can I change the calculation method?
Yes, the settings allow you to switch between EMA and SMA for both the oscillator components and the signal line to better suit your strategy.
How can I access this indicator?
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.