Trend TrendReduced LagMT5 Built-in Im Builder verfügbar

DEMA

DEMA is not a double average — it is an average plus an estimate of its own lag, added back. That extrapolation is what makes it lead, and it is also why the line can sit at a price the market never traded, which no true moving average can do. MetaTrader 5 ships it as iDEMA, and the length you set is half the history it needs.

Period set
14
Bars needed
26
Buffers plotted
1 of 3
DEMA (14) against the plain EMA (14) it is built fromZero — DEMA and the EMA agree, and the lead is goneLag correction added back (derived — iDEMA plots only the line)

Illustrativ — synthetische Daten, kein Live-Kurs.

What DEMA tells you

Every moving average is late, and the lateness is not random — it is roughly proportional to the average's own distance behind price. DEMA exploits that. It takes an EMA, then takes an EMA of that EMA, and the gap between the two is a serviceable estimate of how far behind the first one is running. Doubling the first and subtracting the second adds that estimate back, so the line arrives at a new level far sooner. What you are looking at is therefore not an average of anything: it is an average with a correction bolted on, and corrections can be wrong in the direction of too much.

  • It reaches a new level in about a third of the bars a plain EMA needs
  • It can print values price never traded at — a real average cannot
  • There is no adaptation: the smoothing is fixed, only the lag is cancelled
  1. 1 EMA of price, then an EMA of that EMA
  2. 2 Their difference estimates how far the first EMA is lagging
  3. 3 DEMA = 2 x EMA − EMA(EMA) — the same average with that lag added back
Formel und Berechnungsdetails anzeigen

DEMA is one line of arithmetic:

DEMA = 2 × EMA(price) − EMA(EMA(price))

The trick is in the second term. An EMA lags price; an EMA of that EMA lags it again, by roughly the same amount. So the gap between the two is a usable estimate of how far behind the first one is running — and doubling the first while subtracting the second adds that estimate back on top.

That makes it an extrapolation, not an average. The distinction has a consequence you can see. A moving average is a weighted sum of the prices in its window whose weights add to one, so the result always lands somewhere between the lowest and highest of them. DEMA has no such guarantee:

  • On a step from 100 to 110, the line peaks at 111.17 — above the highest price that ever existed in the series
  • On a random walk with period 14, it sits outside the last fourteen bars’ high-low range on 2.1% of bars
  • The same test run against the plain EMA it is built from: 0.0%

The upside is measured just as plainly. On that same step, a plain EMA needs 20 bars to reach 95% of the new level. DEMA needs 6.

The period is half the history. The second EMA cannot start until the first has produced values, so MT5 sets PLOT_DRAW_BEGIN to 2 × period − 2 and calculates nothing before then. A DEMA(14) needs 26 bars; a DEMA(50) needs 98. Nothing errors — the left of the chart is simply empty.

Earlier is not smoother. The usual reason to reach for this indicator is that an EMA feels late, and the usual mistake is to also expect it to be cleaner. It is the same EMA with a correction added, and the correction amplifies whatever the EMA was doing, noise included. In a trend that is exactly what you want. In a range the correction goes on supplying lead to a move that never arrives, and the crossings multiply — which is what the template’s stop distances, and the trend filter suggested above, exist to survive.

Signale

Die eindeutigen, backtestbaren Signale, die DEMA liefert — und das passende Marktregime für jedes.

Fast / Slow DEMA Cross

Im Builder umsetzbar
Bedingung
A short-period DEMA crosses a longer one
Bestes Regime
Trending
Typische Verwendung
The template's rule — the same crossover shape, arriving earlier

Price Against the Line

Im Builder umsetzbar
Bedingung
Price closes above or below DEMA
Bestes Regime
Trending
Typische Verwendung
A direction filter that turns sooner than an EMA of the same length

DEMA Against Its Own EMA

Im Builder umsetzbar
Bedingung
DEMA crosses the plain EMA of the same period
Bestes Regime
Either regime
Typische Verwendung
Reads the correction term changing sign, which is the moment the lead reverses

Overshoot Past the Range

Fortgeschrittene Logik
Bedingung
The line sits outside the recent bars' high and low
Bestes Regime
Trending
Typische Verwendung
A stretch reading in principle; comparing the line against a rolling range is not a single node

MT5-Implementierung

Was MetaTrader 5 tatsächlich berechnet und zeichnet — die Referenz für jede Regel auf dieser Seite.

Puffer

Index Puffer Darstellung in MT5 Inhalt
0 MAIN_LINE DEMA The line, and the only series MT5 plots. The indicator declares three buffers, but the other two hold the intermediate EMA and the EMA of that EMA and are marked INDICATOR_CALCULATIONS — working storage rather than output. The Builder reads index 0.

Plattform-Hinweise

Funktioniert am besten / mit Vorsicht verwenden

Kein Indikator hat einen universellen Vorteil. Hier hilft DEMA — und wo er irreführt.

Funktioniert am besten

  • Trends where being a few bars earlier is worth paying for
  • As the fast side of a pair, where a slower line supplies the confirmation
  • Timeframes where an EMA of the same length feels a beat behind the move
  • Replacing an EMA that has been shortened repeatedly to chase responsiveness — this is the principled version of that

Mit Vorsicht verwenden

  • Ranges: the correction keeps adding lead to a move that is not going anywhere, so crossings multiply
  • Treating the line as a level — it regularly sits where price has never been
  • Short histories: nothing is drawn until twice the period minus two bars exist
  • Assuming it is smoother than an EMA. It is not smoother; it is earlier, and earlier is noisier

Eine DEMA-Strategie erstellen

Verbinden Sie das Signal mit Einstiegs- und Ausstiegsregeln und exportieren Sie dann einen kompilierbaren MT5 EA — ohne Code.

  1. Two DEMA nodes on Close — one at 14, one at 28
  2. Fast crosses above slow → Close the short, then Open Buy · SL 70 / TP 210
  3. Fast crosses below slow → Close the long, then Open Sell
  4. Both read the last closed bar, so a cross is a settled fact
  5. The close nodes are placed ahead of the entries, and the order matters

DEMA mit anderen Indikatoren kombinieren

Ein einzelner Indikator reicht selten aus. Diese Paarungen decken die blinden Flecken von DEMA ab.

DEMA + Moving Average

  1. A plain EMA at 14
  2. DEMA at 14
  3. Compare
Warum
The comparison that defines this indicator, and the one worth running before anything else is added. Put a plain EMA of the same period next to it: the two share a window and a smoothing constant, so every difference on screen is the lag correction. It also shows the cost directly — the stretches where DEMA has pulled away from the EMA and price has not followed are exactly the false starts
Bestes Regime
Either regime

No single-flow template pairs them. Start from DEMA 14/28 Lead Cross, add a Moving Average node set to EMA 14, and put it into a Compare against the fast DEMA.

Builder öffnen →

DEMA + ADX

  1. ADX above 25
  2. Fast DEMA crosses above slow
  3. Buy
Warum
This indicator's failure mode is specific: the lag correction keeps working in a range, so the line leads a move that is not there and the crossings multiply. A trend-strength reading is the direct answer — it does not make the line better, it decides whether the lead is worth acting on
Bestes Regime
Trending

No single-flow template combines them. Add an ADX node with a Compare at 25 to DEMA 14/28 Lead Cross and join it to the Cross with an And gate.

Builder öffnen →

DEMA + FrAMA

  1. FrAMA above a fixed average
  2. Fast DEMA crosses above slow
  3. Buy
Warum
The two ways of attacking lag, side by side. FrAMA varies how much smoothing is applied, measuring the market and adjusting; this one leaves the smoothing fixed and subtracts an estimate of the lag instead. The practical difference shows up in ranges — FrAMA goes flat and stops signalling, while DEMA keeps leading and keeps crossing. Requiring both to agree is asking for a move that is both directional and clean
Bestes Regime
Trending

No single-flow template pairs them. Add a FrAMA node and a Moving Average node into a Compare, then join that to the DEMA Cross with an And gate.

Builder öffnen →

DEMA + TEMA

  1. TEMA at 14
  2. Fast DEMA crosses above slow
  3. Buy
Warum
The same correction with a third stage, and the pair settles what that stage is worth. Same period on both and the difference between the lines is a second difference of the same EMA chain — pure curvature. It is faster: 4 bars to reach 95% of a step against 6. It is also further from an average, sitting outside the recent 14-bar range on 7.5% of bars against 2.1% here. Running them together is the cheapest way to decide which end of that trade-off suits the instrument, and it is why TEMA's own template puts the faster line on the exit instead of the entry
Bestes Regime
Either regime

No single-flow template pairs them. Add a TEMA node at 14 on Close to DEMA 14/28 Lead Cross and put it into a Compare against the fast DEMA — or start from EMA Cross Entry x TEMA Early Exit and add DEMA there instead.

Builder öffnen →

Parameter

Startwerte zur Validierung auf Ihrem eigenen Paar und Zeitrahmen — keine garantierten Einstellungen.

Parameter Standard Empfohlener Testbereich Was er tut
Period 14 1–999 The EMA length used twice — once on price and once on the result. It behaves like an ordinary length in that longer is slower, but the history it consumes is not what you set: MT5 draws nothing until 2 × period − 2 bars exist, because the second EMA cannot start until the first one has. A DEMA(50) needs 98 bars.
Applied price Close Close / Open / High / Low / Median / Typical / Weighted Which series the whole calculation runs on. Unlike FrAMA, where the setting barely matters, here it is a real control: both EMAs and therefore the correction are computed from whatever you choose.
Shift 0 0–100 Which bar to read. The template sets 1 so a cross is decided on a closed bar. This is not iDEMA's own ma_shift, which slides the drawn line sideways — the Builder pins that to 0 and exposes only the bar offset.
Timeframe Current Current / M1–MN1 Which timeframe's bars the line is built from. Set above the chart and it becomes a faster-than-usual read of a slower trend, which is a reasonable way to use the lead without trading every crossing on the chart's own bars.

Start-Voreinstellungen

Template 14 / 28 Fast and slow at a 1:2 ratio, both on Close
Slower 21 / 55 Fewer crossings; the lead is still there, just over a longer window
Single line 14 One DEMA as a direction filter rather than a crossover pair

Marktbeispiele

Wo DEMA funktioniert, wo er scheitert und wie ein Filter das Ergebnis verändert.

Funktioniert

In before the average

A move begins and the fast line separates from the slow one several bars before the equivalent EMA pair would have crossed. The position is open for the part of the move that a slower crossover spends waiting.

Scheitert

The lead that led nowhere

A sideways stretch produces a cross, then the opposite cross four bars later, then a third. The correction term kept adding lead to a move that was never there — the failure mode the trend filter exists for.

Gefiltert

Same stretch, strength required

The identical range with a trend-strength condition attached to the cross. The lines still cross and no order is sent, because the flow was asked for something the crossover alone cannot say.

FAQ

Is DEMA built into MetaTrader 5?
Yes. iDEMA is a standard MQL5 function taking a symbol, a timeframe, the period, an ma_shift and an applied price, and the terminal also ships a DEMA custom indicator under Indicators\Examples. The Builder calls the built-in, so a generated EA needs no extra files on the terminal that runs it.
Is it just an EMA of an EMA?
No — that would be slower, not faster. It uses an EMA of an EMA, but subtracts it: DEMA = 2 × EMA − EMA(EMA). The second term lags the first in the same way the first lags price, so their difference estimates that lag, and adding it back moves the line forward rather than smoothing it further.
Why does it sometimes go above the highest price on the chart?
Because it is an extrapolation, not an average. An average of a window always lands inside that window's range; the doubling and subtraction here remove that guarantee. Measured on a step from 100 to 110 the line peaks at 111.17, and on a random walk it sits outside the last fourteen bars' range on 2.1% of bars against 0.0% for a plain EMA. It is expected behaviour, and it is the reason not to read the line as a price level.
How many bars does it need before it draws?
2 × period − 2. The EMA of the EMA cannot start until the first EMA has produced values, so a period of 14 needs 26 bars and a period of 50 needs 98. MT5 returns without calculating while the history is shorter, so the left of the chart is simply empty rather than wrong.
How is it different from an adaptive average like FrAMA?
They attack the same problem from opposite ends. An adaptive average varies how much smoothing to apply, measuring the market and easing off when it is directional. DEMA never changes its smoothing — it leaves the EMA exactly as it was and subtracts an estimate of the lag instead. The visible consequence is in ranges: an adaptive line goes flat and stops signalling, while DEMA keeps leading and keeps crossing.
Can I build a DEMA EA without coding?
Yes. The DEMA 14/28 Lead Cross template uses two DEMA nodes on Close and trades the crossings between them, closing the opposite side before it enters. The two periods, the applied price, the shift, the stop distances, the lot and the spread limit are all EA inputs.
How should I validate settings before going live?
Backtest on quality tick data, then demo, and read the trade list rather than only the curve. Two things are specific to this indicator. Make sure the test spans a range as well as a trend — the lead is an advantage in one and a liability in the other, and a test containing only trends measures half the behaviour. And resist shortening the period to get more lead: the correction already supplies it, and a shorter period compounds the overshoot rather than improving the timing.