# ZLEMA

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

A 21-period zero-lag EMA that smooths a de-lagged input, the current price doubled, minus the price (N - 1) / 2 bars back, so the line hugs trends and turns earlier than an equal-length EMA. Ships with slope coloring, a price/ZLEMA gradient fill, an optional slower second ZLEMA crossover pair, a same-length EMA benchmark, a dashboard and six alerts.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 22, 2026.
- Access: free.
- Concepts: [ZLEMA](https://www.luxalgo.com/library/concept/zlema/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=xnuk3qgbqbpe4ijws8vnp3s9
- Page: https://www.luxalgo.com/library/indicator/zlema/

**ZLEMA** is the definitive clean build of the [ZLEMA (zero-lag exponential moving average)](https://www.luxalgo.com/library/concept/zlema/), in the de-lagged-input form most implementations ship. An EMA of length N shows the market roughly as it was (N - 1) / 2 bars ago, so the input is corrected by exactly that amount (the current price doubled, minus the price that many bars back) before a normal EMA smooths the result. An optional same-length EMA overlays as the honest benchmark: closer to price in trends, earlier at turns, including some that never follow through.

## How to Trade the ZLEMA?

- **Slope flips**: the line's slope is the fast regime read, flipping ahead of an equal-length EMA's, with slope-turn alerts at each change.
- **Price crossings**: the source crossing the ZLEMA reads like any moving-average cross, and the smaller lag keeps it within reach of ordinary pullbacks, the dynamic support/resistance read behind the fill.
- **Fast/slow pair**: the optional Second ZLEMA builds the classic crossover setup; both lines turn earlier, so the pair fires earlier and fails more often in chop.

The dashboard reports the canceled lag, the current slope and where price sits.

## ZLEMA Settings

- **Source** (default close): the series the average de-lags and then smooths.
- **ZLEMA Length** (default 21): sets both the smoothing and the correction size; there is no standard number, so start from EMA lengths you already use.
- **Second ZLEMA** (default off) and **Second ZLEMA Length** (default 50): the slower line of the crossover pair.
- **EMA — Same Length** (default off): overlays the plain EMA benchmark.
- **Show Dashboard** (default on): lag canceled, slope, and price-position readout.
- Style toggles: **Slope Trend Coloring** and **Price / ZLEMA Gradient Fill** (on by default), **Price Crossing Markers** (off by default), **Line Width** (default 2).

## Frequently Asked Questions

### What does "zero lag" actually mean here?

The correction is sized to cancel the average delay of an N-bar EMA, about (N - 1) / 2 bars, by adding the last half-window's change back into the input. That is extrapolation: the line hugs trends and turns sooner, but overshoots when the market snaps back.

### How does ZLEMA relate to the Zero-lag MACD?

Same goal, different placement of the fix. The [Zero-lag MACD indicator](https://www.luxalgo.com/library/indicator/zero-lag-macd/) error-corrects the averages themselves inside a MACD, while ZLEMA de-lags the price input before a single EMA, the construction popularized by John Ehlers and Ric Way.

### Which length works best?

There is no canonical ZLEMA setting. Take the EMA length you already trust, compare the two with the built-in EMA overlay, and lengthen it if the faster behavior produces more signals than you want.

## Related indicators

- [Trend Regularity Adaptive Moving Average](https://www.luxalgo.com/library/indicator/trend-regularity-adaptive-moving-average/) (TRAMA): markdown at https://www.luxalgo.com/library/indicator/trend-regularity-adaptive-moving-average.md
- [Machine Learning Moving Average](https://www.luxalgo.com/library/indicator/machine-learning-moving-average/) (Adaptive-lookback MA): markdown at https://www.luxalgo.com/library/indicator/machine-learning-moving-average.md
- [Moving Average Converging](https://www.luxalgo.com/library/indicator/moving-average-converging/) (EMA): markdown at https://www.luxalgo.com/library/indicator/moving-average-converging.md
- [MLMA](https://www.luxalgo.com/library/indicator/mlma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/mlma.md
- [Volume-adjusted MA](https://www.luxalgo.com/library/indicator/volume-adjusted-ma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/volume-adjusted-ma.md
- [JMA](https://www.luxalgo.com/library/indicator/jma/) (Trend): markdown at https://www.luxalgo.com/library/indicator/jma.md
- [T3](https://www.luxalgo.com/library/indicator/t3/) (Trend): markdown at https://www.luxalgo.com/library/indicator/t3.md
- [Hull Butterfly Oscillator](https://www.luxalgo.com/library/indicator/hull-butterfly-oscillator/) (HMA): markdown at https://www.luxalgo.com/library/indicator/hull-butterfly-oscillator.md

---

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