Loading…

Zero Lag Exponential Moving Average

A plain EMA lags price because each new value is a weighted blend with its own past. The usual fix - shortening the period - trades lag for noise. Ehlers and Way's Zero Lag EMA (Stocks & Commodities, August 2000) takes a different approach: it computes a normal EMA, then a second EMA of that first EMA. Because the second EMA lags the first by roughly the same amount the first lags price, the gap between EMA1 and EMA2 approximates the lag itself. Adding that gap back onto EMA1 (2*EMA1 - EMA2) cancels most of it out. The result tracks price noticeably tighter than a plain EMA of the same period, without the overshoot and whipsaw a genuinely shorter EMA period would introduce. It is not lag-free - "zero lag" is the tool's name, not a literal guarantee - but it is a real, published error-correction technique, not a repaint or a curve-fit. Notes and limitations - Non-repainting: every value depends only on closed bars up to and including its own bar. - The error-correction assumes the two EMAs lag by a similar amount, which holds well for trending moves but is only approximate through a sharp reversal - the corrected line can briefly overshoot the reversal itself before settling. - Recomputes the full visible history from bar 0 on every call rather than incrementally updating from prev_calculated, because both chained EMAs depend on their entire prior history; this is deliberate and matches the pattern used by the other chained-EMA indicators in this catalogue. - No entry/exit signals or alerts are generated - it is a smoothing line, read the same way you would read any moving average.

Indicator · MT4 · v1.0 · Free

About Zero Lag Exponential Moving Average

Zero Lag Exponential Moving Average is an indicator for MetaTrader 4. It has 1 setting, such as Period. MQL source code included.

Files in the download: ZeroLagEma.mq4, ZeroLagEma.txt.

Settings

SettingDefaultWhat it does
Period20EMA period used for both chained EMAs

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Moving Average · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria