Concept

ZLEMA

ZLEMA, also known as zero-lag EMA, is a Trend concept. The Library holds 1 implementation, a working definition you can pull into Quant.

Top ZLEMA indicator

The top custom implementation, built on the original standard ZLEMA formula.

1 total

From studying ZLEMA to trading it: take the implementation below into Quant and backtest it instantly.

What is a ZLEMA?

A ZLEMA (zero-lag exponential moving average) is an EMA applied to a de-lagged version of price rather than to price itself. The construction works like this: compute a lag of (length minus 1) divided by 2 bars, build a modified input equal to twice the current price minus the price from that many bars back, then run a normal EMA of the chosen length over the modified series. Adding the recent change back into price cancels much of the phase delay ordinary smoothing introduces.

The technique is usually credited to John Ehlers and Ric Way, whose article "Zero Lag (Well, Almost)" ran in Technical Analysis of Stocks & Commodities in 2010. Ehlers, an engineer who spent decades applying digital signal processing to markets, produced the Ehlers SuperSmoother and several predictive averages from the same body of work. Their article built its version around an error-correcting feedback loop, while the simpler de-lagged-input recipe above is what most implementations ship as ZLEMA. The plumbing differs; the goal is the same.

The cancellation is really extrapolation: the modified input assumes the move of the last half-window continues, so a ZLEMA hugs trends closely and turns quickly, at the price of overshooting when the market snaps back. The article that popularized zero-lag smoothing carried the qualifier "well, almost" in its own title, which is the honest way to read the name. Lag is reduced, not eliminated, and the reduction is paid for with false turns a slower average would have smoothed through.

The lag figure is not arbitrary. An SMA of N bars describes the market as it stood roughly (N minus 1) divided by 2 bars ago, an EMA of nominal length N carries the same average delay, and the ZLEMA's correction term is sized to cancel exactly that amount. The idea also travels: the ZLSMA applies a comparable correction to a least squares moving average, and zero-lag MACD variants rebuild both of that oscillator's averages from de-lagged inputs. Relatives such as DEMA, which doubles an EMA and subtracts an EMA of the EMA, and the Hull moving average, built from weighted averages with a square-root-length final pass, attack lag inside the smoother instead; all share the family trait of less lag traded for more overshoot.

How to calculate a ZLEMA

The construction de-lags the input first, then smooths it. For a chosen length N:

  1. 1Compute the lag as (N minus 1) divided by 2, rounded to a whole number of bars.
  2. 2Build the de-lagged input: two times the current price, minus the price from lag bars ago.
  3. 3Apply a standard EMA of length N to that de-lagged series and plot the result.
  4. 4Sanity-check against a plain EMA of the same length: the ZLEMA should sit closer to price in trends and cross earlier at turns, including some turns that never follow through.

How it's calculated

An EMA computed on a de-lagged price series, so it follows price more closely than a standard EMA of the same length.

lag=n12\operatorname{lag} = \frac{n - 1}{2}
Dt=2×PtPtlagD_t = 2 \times P_t - P_{t - \operatorname{lag}}
α=2n+1\alpha = \frac{2}{n + 1}
ZLEMAt=α×Dt+(1α)×ZLEMAt1\operatorname{ZLEMA}_t = \alpha \times D_t + (1 - \alpha) \times \operatorname{ZLEMA}_{t-1}
P_t: input price at bar t (usually close)
t: bar index (t-1 and t-lag reference earlier bars)
n: length in bars (varies by platform, commonly 14 to 21)
lag: de-lag offset, rounded to the nearest whole bar
D_t: de-lagged price at bar t
α: EMA smoothing factor
ZLEMA_t: zero-lag EMA value at bar t

Attributed to John Ehlers and Ric Way (2010).

Adding P_t - P_(t-lag) back to price cancels roughly the EMA's built-in lag, at the cost of some overshoot at sharp reversals.

Seed the recursion with the first de-lagged value or an SMA, as with a normal EMA.

How traders use it

  • In crossover setups where EMA lag is the main complaint: price/ZLEMA or fast/slow ZLEMA pairs signal earlier, at the cost of more failed crosses.
  • As a drop-in smoother inside other indicators; the zero-lag MACD is the best-known example, rebuilding both of MACD's averages from de-lagged inputs.
  • As a tighter trend baseline for pullback entries and trailing logic, with the line's slope doubling as a quick regime read that flips sooner than an equal-length EMA's.
  • As dynamic support and resistance in strong trends, where the reduced lag keeps the line close enough for ordinary pullbacks to reach it, at the cost of more incidental touches.
  • For earlier breakout confirmation, treating a ZLEMA thrust through the broken level as momentum evidence, gated by a regime filter such as Supertrend to screen out range chop.

ZLEMA vs other moving averages

EMA: The EMA smooths raw price and accepts the resulting lag. The ZLEMA keeps the same smoother but feeds it a momentum-augmented input, so it tracks tighter and turns sooner while carrying overshoot risk the EMA does not have.

Ehlers SuperSmoother: From the same signal-processing tradition, the SuperSmoother attacks noise rather than lag: it strips short-cycle chop with less delay than comparable smoothers but never extrapolates, so it avoids the ZLEMA's overshoot at sharp turns while keeping some honest lag.

Adaptive-lookback MA: Adaptive averages fight lag by shortening their window when conditions speed up instead of extrapolating a fixed one. The aim is the same but the failure modes differ: adaptation can misjudge a regime shift, while de-lagging overshoots sharp reversals.

Concept family

Trend

100 concepts mapped · 100 in the Library

ZLEMA FAQ

Turn ZLEMA into a trading strategy.

Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it in conversation.