◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Indicators / Double Exponential Moving Average (DEMA)
Moving Averages indicator

Double Exponential Moving Average (DEMA)

A lag-compensated combination of two EMAs — 2·EMA minus EMA-of-EMA — that trades smoothness for overshoot.

Illustrative diagram — not live market data.

What it is

The Double Exponential Moving Average was developed by Patrick Mulloy and published in the February 1994 issue of Technical Analysis of Stocks & Commodities. Despite the name, it is not an EMA applied twice — double-smoothing would add lag, the opposite of the goal. DEMA is a lag-compensation formula: DEMA = 2 × EMA(price) − EMA(EMA(price)). It plots on the price chart as a single line that tracks price more closely than a standard EMA of the same length. The compensation is not free: when price turns sharply, DEMA tends to overshoot beyond price before correcting, because the lag estimate it adds back is itself based on past bars. DEMA is a deterministic transformation of past prices — it describes what has already happened with less delay, and it does not predict what happens next. This entry is educational only, not financial advice, and trading involves risk of loss.

How it works

Start with EMA1, a normal EMA of price, which lags price by some amount. Smooth it again to get EMA2 = EMA(EMA1), which lags roughly twice as much. The gap between them, EMA1 − EMA2, is therefore an estimate of one unit of EMA lag. Mulloy's insight was to add that estimate back: DEMA = EMA1 + (EMA1 − EMA2) = 2·EMA1 − EMA2. In a steady trend the gap is a good lag estimate, so DEMA sits noticeably closer to price than EMA1 — that is the direct answer to how DEMA reduces lag: it extrapolates using the measured distance between the single- and double-smoothed lines. The weakness is baked into the same math: at a sharp reversal the gap still reflects the old trend, so the correction pushes DEMA past price in the wrong direction before the EMAs catch up — the characteristic overshoot. Less lag is not free; it is exchanged for overshoot and increased sensitivity to noise. A shorter plain EMA also reduces lag, but with more wiggle; DEMA offers a different point on the same trade-off curve, not an escape from it.

How traders read it

Common settings

DEMA is used with the same lengths traders apply to EMAs — commonly 9 or 20 for short-term reads, 50 for an intermediate view, and 200 for long-term context — on the closing price. Because DEMA(n) is faster than EMA(n), some traders deliberately use a longer DEMA length to get EMA-like smoothness with slightly less lag. As always, changing length or timeframe changes every reading, so settings are something to test, not assume.

Strengths

Pitfalls to watch

Pine v6 example

//@version=6
indicator("DEMA Example", overlay = true)

len = input.int(20, "Length", minval = 1)
src = input.source(close, "Source")

ema1 = ta.ema(src, len)
ema2 = ta.ema(ema1, len)
dema = 2 * ema1 - ema2

plot(dema, "DEMA", color = color.blue, linewidth = 2)
plot(ema1, "EMA (same length)", color = color.new(color.orange, 40))

Pro tip: Plot DEMA and a same-length EMA together and study one sharp reversal closely: you will see DEMA turn earlier and then overshoot past price — both effects come from the same term in the formula. Treat reduced lag as a trade-off knob, not an upgrade, and validate any DEMA-based logic on the exact settings and timeframe you intend to use. Educational information only, not financial advice; no indicator predicts price, and trading involves risk of loss.

Built an indicator from this? Run it through the Validator to catch look-ahead bias and repainting, or convert a strategy to Pine Script.

Educational only — not financial advice, not a recommendation to trade. No indicator is predictive; trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro