Indicator library · Trend

TEMA, Triple Exponential Moving Average

An exponential average with its own lag estimated and added back, twice over. It is genuinely faster than a plain average, and it pays for that at every reversal, where the correction carries it past the price.

The calculation

Three successive exponential averages of the same period, combined:

  • EMA1, an exponential average of the price.
  • EMA2, an exponential average of EMA1.
  • EMA3, an exponential average of EMA2.
  • TEMA: 3 × EMA1 − 3 × EMA2 + EMA3.

The reasoning is worth spelling out because the name hides it. An average lags, and the difference between an average and an average of that average is an estimate of how far behind it is. The double form, DEMA = 2 × EMA1 − EMA2, adds that estimate back. TEMA adds a second-order correction on top of it. Nothing here is smoothed three times; a triple-smoothed average would be slower, not faster.

TEMA through an advance, a reversal and a rangeThe upper panel shows a price series advancing steadily for fifteen bars, reversing sharply over five, then oscillating in a narrow range for ten. The lower panel shows TEMA, which tracks price closely during the advance, continues downward past the price low at the reversal before turning back up, and crosses price repeatedly during the range.CLOSETEMA 844.88overshootTEMA through an advance, a reversal and a rangeThe upper panel shows a price series advancing steadily for fifteen bars, reversing sharply over five, then oscillating in a narrow range for ten. The lower panel shows TEMA, which tracks price closely during the advance, continues downward past the price low at the reversal before turning back up, and crosses price repeatedly during the range.CLOSETEMA 844.88overshoot
Fig. 1: schematicComputed at build time. At the end of the clean advance TEMA sits -0.17 points behind the close, where DEMA sits 0.29 and a plain exponential average of the same period sits 2.91 behind. The lag reduction is real and measurable. Then the reversal: at the marked low the line is 0.66 points on the wrong side of the price, because the correction term extrapolated a direction that had just ended. That is what the speed cost.

What the correction costs

The three lines in the caption above tell the whole story in one direction, and the marked bar tells it in the other. Ordered by responsiveness, the family always behaves the same way:

The same period, three forms
FormBehind price in a trendAt a sharp reversal
EMA2.91Turns late and stays on the correct side of price.
DEMA0.29Turns sooner, mild overshoot.
TEMA-0.17Turns soonest and travels past the price before coming back.

That is not a defect to be tuned out; it is the arithmetic doing exactly what it was written to do. The correction term is an extrapolation of the recent direction, and an extrapolation is wrong precisely when the direction changes. Every lag-reduction scheme in this family makes the same trade, and the more aggressive the correction, the larger the overshoot.

Two ways to want less lag

This page and the KAMA page describe opposite answers to the same complaint, and choosing between them is a question about which error is expensive for you.

TEMA assumes the recent direction will continue and corrects the average forward on that basis. It is right most of the time — trends persist more often than they reverse — and spectacularly wrong at turns. KAMA assumes nothing and instead measures whether movement is efficient, slowing down when it is not. It never overshoots and it is late at every reversal by design.

If false crossings in a range are what cost you money, the adaptive route is the right one. If being late into an established trend is the expensive error, this is the family to look at. What neither can offer, and what no causal filter can, is a line that is early at turns and quiet in chop.

What lag actually is

One paragraph of theory earns its place here, because the whole family rests on it. A moving average is a filter, and every causal filter, one that uses only past data, introduces delay. That is not an implementation weakness; it is what "using only past data" means. The output at each bar is a weighted sum of values that have already happened, so it necessarily describes a moment that has passed.

What TEMA does is estimate that delay and correct for it, which works while the recent past is a good guide to the present and fails when it stops being one. Presenting the result as a "zero-lag" average, as some descriptions do, mistakes an extrapolation for a measurement, and the overshoot at every turn is the arithmetic pointing out the difference.

Where it misleads

Known failure modes
SituationWhat goes wrong
Sharp reversalsThe correction extrapolates a direction that has just ended, so the line travels past the price before returning.
RangesFaster line, more crossings. In a sideways market it can cross price every few bars.
Name taken literallyIt is not an average smoothed three times, and it is unrelated to TRIX despite the similar description.
Short historyThree stacked exponential averages carry the seed a long way; early values are mostly a function of where the data began.
Fed into other indicatorsAn extrapolating input inside something that already differences two averages produces artefacts that look like signals.
Applied to volumeVolume is spiky and has no direction to extrapolate; the correction terms amplify single heavy sessions.

What volume adds

Every input here is a closing price, so the line cannot distinguish the two situations that decide whether its speed is worth anything. An advance that TEMA tracks tightly on expanding volume is a trend with participants behind it; the identical advance on the thinnest sessions of the month is a book with nothing in the way, and it is exactly the case where a fast line will turn out to have been fast in the wrong direction.

The habit is the same one this whole library keeps returning to. Take the shape of the move from the average and the participation from the volume beside it, and treat a fast line on thinning volume as a reason for a smaller position rather than an earlier one.

Frequently asked questions

How is TEMA calculated?

Take an exponential average of the price, then an exponential average of that, then a third of the second. TEMA is 3 × EMA1 − 3 × EMA2 + EMA3. The double form, DEMA, is 2 × EMA1 − EMA2. In both cases the extra terms are there to cancel the lag: the difference between an average and an average of that average is an estimate of how far behind the first one is, and the formula adds that estimate back.

Is it really a "triple exponential" average?

The name is misleading and the confusion is common. TEMA is not an average smoothed three times, that would be slower than a single one, not faster. It is a weighted combination of three successive smoothings arranged so most of the lag cancels. There is a genuinely different indicator, TRIX, which is a rate of change of a triple-smoothed average; the two are unrelated despite the similar description.

Does it actually reduce lag?

Yes, measurably, and not for free. On the advance charted on this page a plain exponential average sits well behind the close while TEMA sits within a fraction of it. What pays for that is behaviour at turns: because the correction term extrapolates the recent direction, TEMA continues in the old direction for a moment after price reverses and then overshoots the other way. Lag has been converted into overshoot rather than removed.

What is the difference between DEMA and TEMA?

How aggressively the correction is applied. DEMA adds one lag-estimate back and TEMA adds a second-order correction on top, so TEMA is faster and overshoots more. On quiet data they are close together; at a sharp reversal the ordering is always the same, EMA late, DEMA less late, TEMA earliest and most likely to have gone past the price.

When is a plain EMA the better choice?

Whenever false signals cost more than late ones, which covers most trend-following. The overshoot at reversals means TEMA crosses price more often, and in a range it can produce a crossing every few bars. If what you need is a line that changes character rarely, this is the wrong family, an adaptive average that deliberately slows down, such as KAMA, is the opposite bargain and the more conservative one.

Can it be used as the input to other indicators?

It can and the results should be treated carefully. Feeding TEMA into MACD or a crossover system makes the whole thing faster and noisier, and any published statistics about that system no longer apply. The specific risk is compounding: an extrapolating input inside an indicator that already differences two averages can produce readings that look like signals and are artefacts of the arithmetic.

How much history does it need?

Considerably more than the period suggests, because three exponential averages are stacked and each carries its seed forward with a decaying weight. The third smoothing is an average of an average of an average of your starting value, so early readings are heavily determined by where the data began. Feed several hundred bars and discard the first few multiples of the period before comparing with anyone else’s figures.

Is TEMA suitable for volume rather than price?

The arithmetic runs on any series, and volume is a poor candidate. Volume is far spikier than price and has no meaningful trend to extrapolate, so the correction terms amplify single heavy sessions into large swings in the line. If a smoothed volume series is what you want, a simple or exponential average of it is the honest tool; the lag it carries is not the problem people imagine it to be.