What Are DEMA and TEMA? Faster Than EMA Because They Subtract the Lag

“DEMA means double EMA, so it must be smoother and steadier, right?”

It is the opposite. DEMA and TEMA do not smooth price more times. They use the EMA of an EMA to measure how far behind it is, then add that lag back. The result is a faster line that sits closer to price and gets crossed back and forth more easily. This article first works it out once with a table, then uses a real chart marked 1 to 4 to show how many bars they save and what that costs.

This article is part of MASQuant’s “Trading Academy · Technical Indicators” series. All the indicators are sorted by category in Technical Indicators: The Complete Guide.

In one sentence

DEMA = EMA + the amount it lags. TEMA = the same correction, applied once more.

Double and Triple in the names refer to two and three layers of EMA in the formula, not to smoothing twice or three times.

EMA is like someone walking behind you. To find out how far behind, you get a second person to walk behind them and measure the gap between those two: however far the second is behind the first is roughly how far the first is behind you. Add that distance back and you get closer to where you are now. That is what DEMA does, and TEMA corrects it once more.

Work it out once: adding the lag back

Suppose the market has been rising and today’s numbers look like this (the following are round numbers for illustration, not market data):

Item Calculation Result Distance from close of 108
EMA (layer 1) Given 100 8
EMA of EMA (layer 2) Given 96 12
EMA of EMA of EMA (layer 3) Given 93 15
DEMA 2 × 100 − 96 104 4
TEMA 3 × 100 − 3 × 96 + 93 105 3

Layer 2 is 4 behind layer 1, so DEMA adds 4 back to layer 1 and gets 104. TEMA corrects again with layer 3 and gets 105. The more layers, the closer to the close.

The formula

The default period in MT5 is 14:

1 EMA1 = EMA(n) of the close
2 EMA2 = EMA(n) of EMA1
3 EMA3 = EMA(n) of EMA2

DEMA = 2 × EMA1 − EMA2
TEMA = 3 × EMA1 − 3 × EMA2 + EMA3

DEMA and TEMA were introduced by Patrick Mulloy in 1994. Both are built-in trend indicators in MT5. Note that TEMA and TRIX use the same three layers of EMA in opposite ways: TRIX takes the rate of change of the third layer, making the line slower and smoother; TEMA combines the three layers to cancel the lag, making the line faster (for TRIX, see What Is the TRIX Indicator?).

Read the chart: S&P 500 in 2019–2020, following 1 to 4

The chart below shows the S&P 500 index (US500) daily from August 2019 to late February 2020, taken from MT5 historical prices. It moves through a range, a rally and a sharp fall: from 1 August to 6 November 2019, closes moved between 2,825 and 3,079; from 7 November 2019 to 23 January 2020, the index rose from 3,087 to 3,327, up 7.8%; on 17 February it set its highest close of 3,388, and by 27 February it had fallen to 2,950.

S&P 500 daily, August 2019 to February 2020: the orange TEMA 14 sits closest to the candles, the purple DEMA 14 next, and the grey EMA 14 is the slowest
Chart: S&P 500 (US500) daily, 1 August 2019 – 27 February 2020, MT5 historical prices. Hollow candles closed up, filled candles closed down; grey shading marks the range, light orange shading marks the trend. The orange line is TEMA(14), the purple line is DEMA(14) and the grey line is EMA(14). Price is on the right, dates along the bottom, and the circled numbers match the notes below.
1

In the range, the faster the line, the more it gets crossed (18 October 2019). Over the 26 candles from 2 October to 6 November, closes crossed EMA once, DEMA 5 times and TEMA 10 times. In the same stretch, TEMA was crossed 10 times as often as EMA.

2

TEMA ends up above the candle (28 January 2020). During the rally, from 8 November 2019 up to the high, there were 14 candles on which TEMA was higher than that day’s high. On this day TEMA was at 3,292 while the day’s high was only 3,286. When the line adds the lag back, it adds too much: this is the overshoot. If a rally suddenly slows, TEMA is still carrying the earlier speed.

3

TEMA falls 1 bar after the high (18 February 2020). The close of 3,388 on 17 February was the high, and TEMA turned the next day, when price had fallen just 0.5%. DEMA turned on the 3rd bar.

4

EMA does not fall until the 4th bar (21 February 2020). By then the close was 3,340, 1.4% below the high. During the rally, the average distance between close and line was 0.98% for EMA, 0.35% for DEMA and 0.30% for TEMA. In this stretch it really was 3 bars faster, at the cost of 9 extra crossings in 1.

This is a real stretch of historical prices, used to show how DEMA and TEMA behave. It is not a general rule. Change the instrument, the timeframe or the period, and every number will change.

What you see, what it means

What you see What it usually means But be careful
TEMA or DEMA rising, close above the line Short-term strength The line hugs price, so a single opposite candle can cross it
TEMA turns before EMA Recent speed has slowed Often the rally is just slowing, not necessarily ending
TEMA drawn outside the candle The line has overshot on earlier speed This is not a real price, so do not treat it as support or resistance (2 on the chart)
Closes keep crossing back and forth The market has no direction Signals here are almost all noise (1 on the chart)

How to use it: three examples

Example 1: DEMA instead of EMA as the fast line

In a rule that uses an EMA 20 and EMA 50 crossover, you can replace the fast line with DEMA 20. Signals come a few bars earlier, with some extra false ones, so compare them with a backtest before switching.

Example 2: confirm a trend first, then use TEMA

TEMA is noisy in a range, so add a trend filter first, such as only reading TEMA’s direction when ADX is above 25 (see What Is the ADX Indicator?).

Example 3: use it to exit, not to enter

TEMA turns quickly, which suits an exit condition: enter on a slower signal and exit when TEMA turns. 3 on the chart is this kind of use. The drawback is getting out early when a rally merely slows midway.

All three examples have to accept the same thing: lag does not disappear for free. DEMA and TEMA trade more noise for less lag.

Common mistakes

1. Assuming Double and Triple mean smoother

The names mislead. TRIX is the one that smooths repeatedly, and its line gets slower; DEMA and TEMA cancel lag, and their lines get faster.

2. Treating an overshooting line as a real price level

In the stretch at 2, TEMA was above that day’s high. That price never traded that day; it is only a calculated number.

3. Swapping the line in with the EMA’s parameters

Change an EMA 14 rule to TEMA 14 and you have a different rule. In the stretch at 1, crossings went from 1 to 10, so stops and filters all need retesting.

FAQ

What is DEMA?

DEMA (double exponential moving average) is calculated as 2 × EMA − EMA of EMA. It uses the second layer of EMA to measure the lag and adds it back to the first layer, so it is faster than EMA.

What is TEMA?

TEMA (triple exponential moving average) is calculated as 3 × EMA1 − 3 × EMA2 + EMA3. With three layers of EMA it lags less than DEMA and overshoots more easily.

Which is better: DEMA, TEMA or HMA?

All three try to reduce lag in different ways: DEMA and TEMA combine EMAs, while HMA combines WMAs. None is always better; it depends on what your rules show in a backtest.

Does MT5 have DEMA and TEMA?

Yes. Both are built-in trend indicators with a default period of 14.

Conclusion

The speed of DEMA and TEMA comes from adding the lag back. What gets added back is not only speed but also noise and overshoot.

So the real question is: once you switch your rules to TEMA, do entries and exits a few bars earlier outweigh the extra false signals? One stretch of historical prices cannot answer that; you have to backtest the rule over many stretches of the market.

Don’t have rules of your own yet, and don’t want to piece them together one indicator at a time? With MASQuant’s Strategy Genie, you just choose an investment style first; the AI analyses market conditions, selects instruments and gives you three candidate strategies at once. Each one has already been backtested on historical data, with its returns and maximum drawdown laid out in the open, and then you decide whether to deploy it to MT5.

If you already have an idea of your own, write the condition as one sentence, for example “only go long when ADX is above 25 and TEMA 14 is rising”, give it to the AI Strategy Assistant, and press go to start the backtest. The backtest environment includes real market frictions such as spreads, slippage, changes in market liquidity and execution delays (see the AI Strategy Assistant guide for how to use it). Then switch TEMA back to EMA and run it again, and you will see the difference. A backtest tells you “how this rule performed in past market conditions”, not a guarantee about the future.

An idea only becomes a strategy once it’s been tested.

Not sure which strategy to use?

New here? Start with this 10-minute beginner’s guide. It walks you through picking your investment style, letting MASQuant’s Strategy Genie use AI to generate and backtest candidate strategies, and running one on an MT5 demo account, step by step.

Read the 10-Minute Beginner’s Guide →

Ready already? Sign in with Google to start for free. No credit card needed for your 15-day free trial.

All strategies and backtests are for reference only and do not constitute investment advice.

The price chart in this article is taken from historical prices on the MT5 platform (daily; quotes and daily candle cut-off times differ slightly between platforms, so values may not match exactly), and the indicators are calculated by a program using the standard formulas; the round numbers in the example are not market data. Historical prices are used only to show how the indicator behaves and do not represent future price movements.

Risk disclosure: CFDs are high-risk financial products and can lead to rapid loss of capital. Past performance does not guarantee future results. All strategies and backtests are for reference only and do not constitute investment advice. Please read our Risk Disclosure carefully before trading.