# Triple Exponential Moving Average (TEMA): Formula and Strategy

URL: https://emaindicator.com/blog/triple-exponential-moving-average/
Published: 2026-05-14T09:00:00+05:30
Modified: 2026-05-06T06:00:00+05:30
Category: Indicators
Type: Spoke (hub: moving-averages-complete-guide)

The **Triple Exponential Moving Average (TEMA)** is the next step up from DEMA in Patrick Mulloy's family of lag-removed moving averages. By adding one more EMA to the nested chain and using a 3-3-1 weighting, TEMA cancels approximately two layers of EMA lag — making it one of the fastest-reacting moving averages in standard use. The trade-off is sensitivity to single-bar noise: TEMA reacts to fresh data more aggressively than DEMA, which reacts more aggressively than EMA.

This guide walks through the TEMA formula, the math behind the 3-3-1 weighting, a worked example, and when TEMA earns its keep on Indian-index charts.

## The core idea — extending the lag-cancel trick

In our [DEMA post](/blog/double-exponential-moving-average/) we showed how subtracting EMA(EMA) from twice EMA cancels approximately one bar of lag per period. The natural question: can we cancel two bars of lag by going one level deeper?

The answer is yes. Compute three nested EMAs, weight them with the coefficients 3, −3, 1, and you produce a moving average whose lag is approximately the negative of two EMA layers' lag. That is TEMA.

The 3-3-1 coefficients are not arbitrary. They come from the binomial expansion that cancels lag terms when you compose multiple EMAs. The pattern continues — a "quadruple EMA" would use coefficients 4, −6, 4, −1 — but in practice nobody goes beyond TEMA because the noise sensitivity grows faster than the additional lag-removal benefit.

## The formula

```
EMA1 = EMA(P, n)
EMA2 = EMA(EMA1, n)
EMA3 = EMA(EMA2, n)
TEMA = 3 × EMA1 − 3 × EMA2 + EMA3
```

All three EMAs use the same period `n` and the same smoothing factor `α = 2/(n+1)`. The recursion for each is the standard EMA (see our [EMA formula post](/blog/exponential-moving-average-formula/) for the full derivation).

For a 21-period TEMA, all three EMAs use `α = 2/22 ≈ 0.0909`. Each new EMA value blends 9.09% of its input with 90.91% of its previous value.

## A worked example — TEMA(10) on NIFTY 50

Suppose you have 50 daily closes. To compute TEMA(10):

**Step 1.** Compute EMA1 = EMA(P, 10) using the standard recursion. Need at least 10 bars for the first EMA1 value to be meaningful.

**Step 2.** Compute EMA2 = EMA(EMA1, 10). Use EMA1 as the input series. Need at least another ~10 bars after EMA1 stabilises.

**Step 3.** Compute EMA3 = EMA(EMA2, 10). Use EMA2 as the input. Need another ~10 bars.

**Step 4.** For every bar where all three are defined, TEMA = `3 × EMA1 − 3 × EMA2 + EMA3`.

For example: if EMA1 = 24,400, EMA2 = 24,360, EMA3 = 24,330, then:

```
TEMA = 3 × 24,400 − 3 × 24,360 + 24,330
     = 73,200 − 73,080 + 24,330
     = 24,450
```

The TEMA value of 24,450 sits ahead of EMA1 (24,400) — the lead generated by the lag cancellation. Compare to the equivalent DEMA at this configuration, which would be `2 × 24,400 − 24,360 = 24,440`. TEMA is fractionally further ahead.

## How much lag does TEMA remove?

For an n-period EMA, the effective lag is `(n−1)/2`. For a 10-EMA, that is 4.5 bars.

Each layer of EMA composition adds approximately `(n−1)/2` more bars of lag. So:

- EMA1 lag: `(n−1)/2`
- EMA2 lag: `(n−1)`
- EMA3 lag: `3(n−1)/2`

The 3-3-1 weighting in TEMA produces a final lag of approximately `−(n−1)/2` — i.e., TEMA leads price by half a period in steady trends. In practice, TEMA's effective lag on NIFTY daily data is between −1 and 0 bars, depending on how clean the trend is.

That makes TEMA the fastest standard moving average. HMA achieves comparable speed via a different construction (see our [HMA post](/blog/hull-moving-average/)). Most other "fast" moving averages — adaptive MAs, Kaufman's KAMA, etc. — are roughly in the same speed band.

## TEMA vs DEMA — the trade-off

| | DEMA | TEMA |
|---|---|---|
| Layers of EMA | 2 | 3 |
| Lag cancelled | ~1 layer | ~2 layers |
| Effective lag | ~0 | ~−0.5 |
| Speed at trend changes | Fast | Faster |
| Smoothness in trends | Good | Comparable |
| Sensitivity to single-bar moves | Moderate | Higher |
| Required warm-up bars | 2n | 3n |

TEMA wins when you want maximum responsiveness and the instrument is reasonably clean (trending equities, NIFTY 50 in clear bull or bear phases). DEMA wins when noise dominates and you do not need the extra speed (BANK NIFTY around expiry, single stocks around earnings).

For most NIFTY 50 use cases, the practical difference between DEMA and TEMA at the same period is small — both lead EMA by 1-3 bars at trend changes. Picking between them is more about which your platform implements and which your eye prefers visually.

## When TEMA wins on Indian indices

**Trending bull markets.** During clean uptrends like the 2020-2021 NIFTY rally, TEMA-based signals flip earlier than EMA or even DEMA, capturing the early portion of each leg. The cost — extra noise — is masked by the strong trend.

**Daily-chart entries on NIFTY 50.** A 50-period TEMA on daily NIFTY tends to flip 2-3 days before 50-EMA at trend changes. That lead translates into better entries for swing trades, with comparable false-signal rate when paired with a regime filter.

**Confirmation, not entry.** Some traders use TEMA not as the entry trigger but as a fast confirmation: enter on a slower signal (e.g., 50-EMA cross), but check that TEMA agrees in direction. The double-confirmation reduces premature entries.

## When TEMA fails

**Choppy intraday timeframes.** A 9-TEMA on 5-minute NIFTY flips erratically in a sideways session — the lag cancellation amplifies short-term noise. On chop-prone timeframes, longer TEMA periods (50, 100) restore some smoothness.

**Gap-prone instruments.** TEMA's three-layer composition gives recent bars triple-amplified influence. A large overnight gap can pull TEMA sharply, even if subsequent price action is unchanged.

**Without a regime filter.** TEMA-only strategies break down badly in ranges. The faster the moving average, the more important the regime gate. Always check the [regime classifier](/nifty-regime/) before trusting a TEMA signal.

## Common TEMA periods on Indian indices

- **9-TEMA / 14-TEMA** on 15-min — intraday momentum (use carefully, requires filters)
- **21-TEMA** on 15-min — intraday bias (most popular)
- **50-TEMA** on daily — primary trend filter (a faster alternative to 50-EMA or 50-DEMA)
- **100-TEMA / 200-TEMA** on daily — long-term filters

For NIFTY 50 specifically, 50-TEMA on daily produces a moving-average crossover signal (when paired with 200-TEMA or 200-EMA) that flips 2-4 bars earlier than the equivalent SMA-based Golden / Death Cross — see [our 50/200 SMA Golden Cross page](/sma-50-200-crossover/) for the textbook SMA version.

## Implementation

In **Pine Script** (TradingView):

```pine
//@version=5
indicator("TEMA", overlay=true)
length = input.int(21, title="Period")
ema1 = ta.ema(close, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
tema = 3 * ema1 - 3 * ema2 + ema3
plot(tema, color=color.orange, linewidth=2)
```

In **Python / pandas**:

```python
import pandas as pd

def tema(prices: pd.Series, n: int) -> pd.Series:
    ema1 = prices.ewm(span=n, adjust=False).mean()
    ema2 = ema1.ewm(span=n, adjust=False).mean()
    ema3 = ema2.ewm(span=n, adjust=False).mean()
    return 3 * ema1 - 3 * ema2 + ema3
```

Four lines including the `def`. Like DEMA, TEMA is built into most charting platforms.

## Putting it together

TEMA is DEMA with one more layer of lag-cancellation. It reacts faster than DEMA, stays comparably smooth in trends, and is a sensible choice for trend-followers who want maximum responsiveness. The main risk is increased sensitivity to single-bar noise — pair TEMA with the regime classifier and timeframe-alignment tools to filter out the contexts where its noise gets amplified.

For most discretionary traders, picking between EMA, DEMA, TEMA, and HMA at the same period is a small optimisation — all four are within a few bars of each other at typical trend changes. The bigger wins come from the surrounding filters: regime gate, alignment check, whipsaw rate, and position sizing.

## Frequently asked questions

**What is the Triple Exponential Moving Average?**

TEMA is a moving average defined as 3 × EMA(P, n) − 3 × EMA(EMA(P, n), n) + EMA(EMA(EMA(P, n), n), n). It was developed by Patrick Mulloy in 1994 alongside DEMA and uses three nested EMAs with a 3-3-1 weighting to remove approximately two layers of lag from the underlying EMA.

**What is the formula for TEMA?**

TEMA = 3 × EMA1 − 3 × EMA2 + EMA3, where EMA1 = EMA(P, n), EMA2 = EMA(EMA1, n), EMA3 = EMA(EMA2, n). The 3-3-1 coefficients are mathematically chosen to cancel two consecutive layers of EMA lag while preserving the average's smoothness.

**What is the difference between TEMA and DEMA?**

DEMA uses two nested EMAs and removes one layer of lag: DEMA = 2 × EMA1 − EMA2. TEMA uses three nested EMAs and removes two layers of lag: TEMA = 3 × EMA1 − 3 × EMA2 + EMA3. TEMA is faster than DEMA at trend changes but is also more sensitive to single-bar volatility.

**Is TEMA good for day trading NIFTY?**

TEMA can be useful for day trading on NIFTY 50 because of its low lag, but it requires strong filters. Without a regime gate, the lag-cancellation amplifies noise on choppy intraday bars. Pair it with the live regime classifier and multi-timeframe alignment, and use slightly longer periods (e.g., TEMA 21 instead of TEMA 9) to keep the noise manageable.

**What are the best TEMA settings?**

On NIFTY daily, 21-TEMA is a common entry-trigger setting; 50-TEMA is a common trend filter. On 15-minute charts, 21-TEMA gives a fast intraday bias. On 5-minute charts, longer TEMA (50 or 100) reduces noise enough to be usable. Avoid very short TEMA on noisy timeframes — the lag-cancellation can over-react to single bars.
