All indicators

MACD Cross Overlay

Jan 23, 2019

Static chart image
Dynamic OverlaysSignalsOscillatorsMoving Averages

The MACD Cross Overlay indicator provides a visual representation of MACD crossovers directly on the price chart, helping traders identify momentum shifts without needing a separate oscillator window.

Usage

The indicator highlights when the MACD line crosses its signal line using visual markers and background coloring.

  • Crossovers: A green "x" appears at the top of the chart when the MACD line crosses above the signal line (bullish), while a red "x" appears when it crosses below (bearish).
  • Trend Context: The background color shifts between light green (MACD > Signal) and light red (MACD < Signal) to provide a constant sense of current momentum.
  • Optional Overlay: Users can toggle the display of the MACD and Signal lines themselves directly on the price pane to see the raw values and distance between them.

Details

This script calculates the standard Moving Average Convergence Divergence (MACD) using the difference between two moving averages (Fast and Slow) and a Signal line derived from that difference. Unlike traditional MACD indicators that reside in a sub-pane, this version is designed as an "overlay," allowing for better correlation between price action and momentum signals. It includes logic for both signal line crossovers and zero-line crossovers, which are common triggers for trend confirmation.

Settings

  • MACD Fast Length: The period for the shorter moving average (default is 12).
  • MACD Slow Length: The period for the longer moving average (default is 26).
  • MACD Source: The price source used for calculations (default is Close).
  • MACD Signal Smoothing: The period for the signal line calculation (default is 9).
  • MACD Simple MA(Oscillator): Toggle to use a Simple Moving Average (SMA) instead of an Exponential Moving Average (EMA) for the MACD line components.
  • MACD Simple MA(Signal Line): Toggle to use an SMA instead of an EMA for the Signal line.
  • MACD Plot Graph Overlay: When enabled, the MACD and Signal lines are plotted directly on the price chart.

FAQ

How do I interpret the background colors? The green background indicates the MACD line is above the Signal line, suggesting bullish momentum, while red indicates it is below, suggesting bearish momentum.

Can I set alerts for these crosses? Yes, the script includes alert conditions for Bullish/Bearish signal line crosses and for the MACD line crossing the zero level.

How can I access MACD Cross Overlay? 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.