WhitmanTrading

Zero Lag EMA (ZLEMA): Tested Against the EMA on 32 Years of SPY

A zero lag EMA (ZLEMA) is an exponential moving average calculated on a corrected price: today's close plus the change since a set number of bars ago. The correction pulls the line toward current price, so it turns sooner than a plain EMA of the same length, but it still lags.

A zero lag EMA, or ZLEMA, is an exponential moving average calculated on a corrected price: today’s close plus the change since a set number of bars ago. The correction drags the line toward the latest price, so it turns sooner than a plain EMA of the same length, though it never removes the delay completely. This page sets out the exact formula, clears up where the name comes from, and then measures the speed against the noise on 32 years of daily SPY closes.

How it works

Start with the look-back. For a period of n bars the formula uses lag = (n − 1) / 2. Rounded down to a whole bar, as in the test below, a 20-period line uses 9 bars and a 10-period line uses 4.

Next, build the corrected price. For each bar, take the close and add the change since the close lag bars earlier: close + (close − close[lag]). If price has risen $10 over those 9 bars, the input is $10 above today’s close. If it has fallen, the input sits below it.

Then smooth it like any EMA. The weight is the usual α = 2 / (n + 1), which is 2/21, or about 0.0952, for 20 periods. Each new value is α times the corrected price plus (1 − α) times the previous value.

Why that helps. An exponential moving average of period n trails a steady trend by roughly (n − 1) / 2 bars. Adding back the move over that same stretch is an estimate of where the average would be without the delay. It is only an estimate: when the trend bends, the correction is extrapolating from a move that has already ended.

Where the name and the formula come from

The formula above is a widely used one, and it is the version this page tests. The name is often credited to John Ehlers and Ric Way’s article “Zero Lag (Well, Almost)”, which ran in Technical Analysis of Stocks & Commodities in November 2010 (volume 28, issue 11, pages 30 to 35, per the magazine’s own store listing).

That article describes a different filter. The text, read on 26 September 2026 from the copy on the MESA Software website, builds what it calls an error-correcting line. It adds the gap between the latest price and the line’s previous value, multiplied by a gain. On its default settings the code tries gains from −5 to +5 on every bar and keeps the one that leaves the smallest error. There is no (n − 1) / 2 look-back anywhere in it.

So the two share a goal, not a recipe. Both push an exponential average toward current price, and the article’s own title concedes the delay is only mostly gone. When a platform labels an indicator “zero lag”, read its code before assuming which of the two it runs.

A worked example

Take the 20-period ZLEMA on SPY for Friday 25 September 2026. The close was $771.35. Nine sessions earlier, on Monday 14 September, the close was $760.88.

Step one, the corrected price. $771.35 + ($771.35 − $760.88) = $771.35 + $10.47 = $781.82.

Step two, the smoothing. The ZLEMA on Thursday 24 September stood at $765.49. The new value is 2/21 × $781.82 + 19/21 × $765.49, which comes to $767.05 using these rounded inputs. Run at full precision, the series prints $767.04.

Step three, the comparison. A plain 20-period EMA moved from $765.25 to $765.83 on the same day. So the close sat $4.31 above the ZLEMA and $5.52 above the EMA. Both lines trailed a rising price, and the zero lag version trailed it by about 22% less.

The test, defined before the results

Every setting below was fixed before any count was made.

The method follows the zigzag indicator idea of marking a swing high or low only after price has moved a fixed percentage away from it.

The original data

At 20 periods the ZLEMA turned about one session sooner. Its median lag after a swing was 2 sessions, against 3 for the EMA, and the mean was 2.06 against 2.88. Turn by turn, it reached its own high or low first on 127 of the 236 swings, on the same session on 77, and later on 32. On 15 swings for the EMA and 9 for the ZLEMA the search reached the next swing before the line turned, so those lags are floors.

20-period line, SPY 1994-2026 EMA ZLEMA
Median lag after a 5% swing 3 sessions 2 sessions
Mean lag after a 5% swing 2.88 sessions 2.06 sessions
Close crossed the line 1,054 times (32.3 a year) 1,847 times (56.6 a year)
Crossings reversed within 5 sessions 668 (63.4%) 1,248 (67.6%)
Average distance from the close 1.63% 0.99%
Sessions outside the last 20 closes 0 318 (3.87%)
Paired bars for 10, 20 and 50 periods showing the zero lag line turning slightly sooner after SPY swings while being crossed by price almost twice as often per year.
Median sessions from a 5% SPY swing to the line's own turn, and closes crossing the line per year, EMA against ZLEMA at 10, 20 and 50 periods, 1994 to 2026. Source: Yahoo Finance SPY daily closes (m42-zlema-vs-ema-spy-summary-1993-2026.csv).

The speed held in both halves of the sample. From 1994 to 2009 the median lag was 3 sessions for the EMA and 2 for the ZLEMA over 129 swings; from 2010 to 2026 it was the same 3 against 2 over 107 swings. The crossing rate barely moved either, 32.3 against 56.9 a year in the first half and 32.3 against 56.4 in the second.

Other periods tell the same story. At 10 periods the median lag fell from 2 sessions to 1, while crossings rose from 46.7 to 88.7 a year and 90.5% of the zero lag crossings reversed within 5 sessions. At 50 periods the lag gap narrowed to 4.5 against 4 sessions, and each line was still unturned when the next swing arrived on 25 of the 236 swings, so a 5% swing is too short to judge a 50-period line well.

The clearest single case is April 2025. SPY closed at $612.93 on 19 February 2025 and fell 19.0% to a close of $496.48 on 8 April. That day the ZLEMA stood at $524.91, 5.7% above the close, and the EMA at $548.88, 10.6% above it. The swing rule scores the EMA as turning one session later, but only because the 10.5% jump on 9 April ended the search window. On the chart both lines kept falling: the ZLEMA bottomed on 16 April at $519.25 and the EMA on 23 April at $537.02, four sessions later.

SPY daily closes from late February to late May 2025 with a 20-day exponential average and a 20-period zero lag average, the zero lag line bottoming closer to the April low.
SPY daily closes with a 20-period EMA and a 20-period ZLEMA, 25 February to 21 May 2025, around the 8 April low. Source: Yahoo Finance SPY daily closes (m42-zlema-vs-ema-spy-turns-1993-2026.csv).

Both tables are published: the ZLEMA and EMA summary for all three periods, and the 236 scored swings with each line’s turn date and lag, so every count can be rechecked.

Demand for the topic is small but well watched. In the 24,971-video corpus this site studies, counted once per video id, 13 titles from 12 channels match, at a median of 21,995 views. A match is the phrase “zero lag” or the abbreviation ZLEMA anywhere in the title. That is about 2.1 times the median of 10,684 for the whole corpus, and 4 of the 13 passed 100,000 views. Only 3 of them name the zero lag EMA itself, and 2 are about a zero lag version of MACD, so the phrase is used more as a promise than as the name of one formula.

What the faster turn costs

Almost twice as many crossings. Over 32.6 years the close crossed the 20-period ZLEMA 1,847 times, 75% more than the 1,054 crossings of the EMA. Most of the extra ones were short-lived: two out of three zero lag crossings were undone within a week of trading.

It hugs price, which is the point and the problem. Its average distance from the close was 0.99%, against 1.63% for the EMA. A line that close to price will be touched by ordinary daily noise.

It can run past price. An EMA is a weighted average of closes it has already seen, so it only leaves the recent range when much older closes drag it there. The ZLEMA’s input is extrapolated, so it can get ahead of every recent close. On 318 of the 8,222 sessions it sat outside the range of the last 20 closes, that day included; the EMA did so on none. At the swing points themselves the effect was small, though: on 6 of the 229 swings where it started on the far side of the swing close, the zero lag line ran past that close, by a median of 0.07%.

When it fails

It fails first in sideways markets. A sideways stretch produces many small moves and no trend, and a line built to react quickly reacts to each of them. On this data most of the extra crossings were reversals within a week, which is exactly what a crossover rule pays for.

It fails on sharp V-shaped turns in a quieter way. The correction assumes the last few weeks’ move is still running. After a spike, it keeps projecting, which is why the line can end up beyond every recent close.

It fails as a comparison when the lengths differ. A 20-period ZLEMA and a 20-period EMA are not equally smooth. Comparing it with a shorter EMA, or a double exponential moving average at another length, can make either look better. Test at matched lengths, and do not tune the period until the past looks good, which is overfitting.

And it fails as a claim. Nothing in this test measured profit. It measured when each line turned and how often price crossed it, on one index fund, at daily bars, with one swing rule. A different market, a smaller swing threshold or an intraday chart will give different counts.

The exponential moving average page covers the average the ZLEMA is built on, and why its delay is set by its length. The double exponential moving average and the triple exponential moving average chase the same goal by stacking averages instead of correcting the price.

The Hull moving average does it with weighted averages of different lengths, and the adaptive moving average changes its speed with the market instead of fixing it. The moving average page explains what every one of them is trading off.

What I actually do

Before I swap an EMA for a zero lag version, I count how many extra times price would have crossed it over the last year on my own chart. If that number is bigger than the one day it saves, I keep the plain EMA.

— Michael Whitman

This page is educational, not financial advice. Test every idea on your own charts before risking money.