# Zero-lag MACD

Zero-lag MACD is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

The familiar MACD run on de-lagged averages: each EMA is error-corrected by doubling it and subtracting the EMA of that EMA, so crosses at the signal line and zero line arrive a few bars ahead of the classic study. Standard 12/26/9 defaults, a switchable de-lagged signal line, a histogram shaded by whether the spread is widening, a zero-line gradient fill and six alerts.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Mar 29, 2026.
- Access: free.
- Concepts: [Zero-lag MACD](https://www.luxalgo.com/library/concept/zero-lag-macd/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cw3z886sk5osgr39qhbikqmh
- Page: https://www.luxalgo.com/library/indicator/zero-lag-macd/

**Zero-lag MACD** is the definitive clean build of the [zero-lag MACD](https://www.luxalgo.com/library/concept/zero-lag-macd/): the familiar 12/26/9 study with most of its smoothing delay compensated away. Each average is de-lagged with a double-EMA correction (twice the average, minus an EMA of it), the MACD line is the gap between the corrected fast and slow averages, and by default the signal line receives the same correction so all three components run on the earlier clock. Histogram columns shade bright while the spread is widening and fade once it narrows (the early inflection cue), with a gradient fill tying the MACD line to zero.

## How to Trade the Zero-lag MACD?

- **Signal-line crosses**: the MACD line crossing the signal line is the trigger, arriving a few bars ahead of the classic construction.
- **Zero-line crosses**: the MACD line crossing zero means the de-lagged fast average has moved across the slow one, the bias read.
- **Histogram turns**: the bright-to-faded shading and the turn alerts flag the spread swinging back before the cross itself prints.

De-lagging is a trade, not free speed: earlier crossovers are paid for with overshoot past sharp turns (the snap-back is the correction working as designed) and extra crosses in chop, so pair the triggers with a regime filter.

## Zero-lag MACD Settings

- **Source** (default close): the series fed into the de-lagged averages.
- **Fast Length** (default 12): the fast de-lagged EMA; the standard number keeps comparisons meaningful.
- **Slow Length** (default 26): the slow de-lagged EMA subtracted from the fast one to form the MACD line.
- **Signal Length** (default 9): smoothing of the MACD line into the signal line.
- **De-lag Signal Line** (default on): applies the same correction to the signal line; disable for a plain-EMA signal that is steadier but slightly later.
- Style toggles: **Show Histogram** and **Gradient Fill** (both on by default).

## Frequently Asked Questions

### How much earlier is it than the standard study?

Typically a few bars around ordinary turns, because the double-EMA correction removes most of each average's smoothing delay. Regime reads agree with the [classic MACD](https://www.luxalgo.com/library/indicator/macd/); timing is where the two diverge.

### Should the signal line be de-lagged too?

Published versions differ on which lines they correct, hence the switch. Leaving De-lag Signal Line on keeps all three components consistent and earliest; turning it off yields a steadier signal line that triggers slightly later.

### What is the cost of removing the lag?

Overshoot and chop sensitivity. The corrected averages run past sharp turns before snapping back, and in sideways markets the earlier clock produces more failed crosses than the standard construction.

## Related indicators

- [Adaptive MACD](https://www.luxalgo.com/library/indicator/adaptive-macd/) (MACD): markdown at https://www.luxalgo.com/library/indicator/adaptive-macd.md
- [MACD Based Price Forecasting](https://www.luxalgo.com/library/indicator/macd-based-price-forecasting/) (MACD): markdown at https://www.luxalgo.com/library/indicator/macd-based-price-forecasting.md
- [Volume-weighted MACD](https://www.luxalgo.com/library/indicator/volume-weighted-macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/volume-weighted-macd.md
- [Impulse MACD](https://www.luxalgo.com/library/indicator/impulse-macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/impulse-macd.md
- [MACD-V](https://www.luxalgo.com/library/indicator/macd-v/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/macd-v.md
- [Schaff Trend Cycle](https://www.luxalgo.com/library/indicator/schaff-trend-cycle/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/schaff-trend-cycle.md
- [MACD](https://www.luxalgo.com/library/indicator/macd/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/macd.md
- [OsMA](https://www.luxalgo.com/library/indicator/osma/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/osma.md

---

Source: https://www.luxalgo.com/library/indicator/zero-lag-macd/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
