ZLEMA
By LuxAlgoJun 22, 2026
ZLEMA is the definitive clean build of the ZLEMA (zero-lag exponential moving average), 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 — 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 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.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
