TradingView indicator comparisons

DEMA vs TEMA on TradingView: smoothing orders and overshoot

DEMA combines two cascaded exponential moving averages as 2E1 − E2. TEMA adds a third component: 3E1 − 3E2 + E3. Both compensate for lag by subtracting smoothed values; neither is simply a repeatedly smoothed EMA. In the identical length-5 example below, TEMA reaches a new constant price one bar before DEMA, but overshoots it more. Equal periods therefore do not mean equal smoothing, and a higher order does not establish better trading returns.

See the decision guide

Expand the cascaded components before comparing the lines

Let x be the current source price, N a positive integer period, alpha = 2 / (N + 1), and q = 1 − alpha. Each stage uses the current output of the preceding stage and its own previous-bar state. The subtraction in the final combinations changes the weighting; the number of EMA stages alone does not describe the smoothness of the output.

  • E2 by itself is a twice-smoothed EMA; E3 by itself is a three-times-smoothed EMA. Neither is the final DEMA or TEMA.
  • At N = 5, alpha = 1/3. A one-unit change in the current source, with previous states held fixed, changes DEMA by 2alpha − alpha² = 5/9 and TEMA by 3alpha − 3alpha² + alpha³ = 19/27. These sensitivities are approximately 0.556 and 0.704, despite identical periods.
  • For N = 1, alpha = 1 and all stages equal the current source. Both outputs equal price, so a strict price-versus-average crossing rule produces no signal. Missing observations and different seeding conventions require separate handling.
ComponentCurrent-bar calculationRole
E1alpha × x + q × previous E1EMA of the source.
E2alpha × current E1 + q × previous E2EMA of E1, with the same N.
E3alpha × current E2 + q × previous E3EMA of E2, with the same N.
DEMA2 × E1 − E2E1 plus the correction E1 − E2.
TEMA3 × E1 − 3 × E2 + E3DEMA plus the extra correction E1 − 2 × E2 + E3.

One price sequence: step response and overshoot

This is a synthetic arithmetic experiment, not market history or a strategy backtest. Initialize E1, E2 and E3 to 100 at bar 0, equivalent to a constant prior source of 100. Use N = 5 for all stages. Bars 1 through 20 close at 110. Bars 21 through 28 then alternate 110.2, 109.8, four times. Do not reset the averages between phases. Values below are rounded to three decimals; calculations retain full precision.

  • Bar 1 can be checked directly: E1 = 310/3, E2 = 910/9 and E3 = 2710/27. DEMA = 950/9 = 105.555556; TEMA = 2890/27 = 107.037037.
  • Define response delay as the first bar at or above 110 after the step. TEMA reaches it on bar 2; DEMA reaches it on bar 3. This measure does not imply either has settled at that price.
  • Across bars 1 through 20, DEMA peaks at 110.877915 on bars 5 and 6. TEMA peaks at 111.097394 on bar 4. Relative to the 10-unit input step, those overshoots are 8.779% and 10.974%, calculated as (peak − 110) / 10 × 100.
  • TEMA subsequently falls below 110, including 109.923 on bar 10, while the close is still 110. Overshoot and undershoot are properties of the weighted calculation; they do not prove that the source price reversed.
BarCloseE1E2E3DEMATEMA
0100100.000100.000100.000100.000100.000
1110103.333101.111100.370105.556107.037
2110105.556102.593101.111108.519110.000
3110107.037104.074102.099110.000110.988
4110108.025105.391103.196110.658111.097
5110108.683106.488104.294110.878110.878
6110109.122107.366105.318110.878110.585
10110109.827109.249108.189110.405109.923
20110109.997109.977109.907110.017109.967

The low-volatility continuation still produces false turns

Continue the same state into bars 21 through 28. The 0.4-unit high-to-low range is about 0.364% of the 110 center. Classify each completed close as above or below its average, holding the prior state on exact equality. For this experiment, call a directional switch a false turn when the very next close returns to the opposite side. This is a one-bar persistence definition, not a universal trading loss criterion.

  • Within this phase, both methods switch sides seven times, on bars 22 through 28. All six switches with an observable next bar, bars 22 through 27, fail the one-bar persistence test. Bar 28 has no subsequent observation and is excluded from that count.
  • The readings differ but the signal sequence is identical. This example does not support a claim that TEMA always creates more trades or that DEMA removes range noise.
  • If alternation continued until initialization effects faded, the length-5 EMA would transmit 1/5 of its amplitude. DEMA transmits 2/5 − 1/25 = 0.36; TEMA transmits 3/5 − 3/25 + 1/125 = 0.488. Thus a ±0.2 input oscillation leaves ±0.072 in DEMA and ±0.0976 in TEMA. Equal N is not equal noise attenuation.
BarCloseDEMATEMAClose relative to both
21110.2110.123110.115Above
22109.8109.957109.899Below
23110.2110.087110.087Above
24109.8109.936109.890Below
25110.2110.076110.087Above
26109.8109.929109.894Below
27110.2110.072110.091Above
28109.8109.928109.898Below

Separate indicator delay from trading-rule delay

A close crossing above its average can occur at the first step bar for both methods, even though their step-level response times differ. Conversely, an average crossing a fixed threshold can differ by a bar. Choose the event your rule actually uses before describing either indicator as faster.

  • In TradingView, match symbol, source, length, chart interval, session and loaded history. Use zero display offset and check that an indicator is not requesting a different timeframe.
  • Compare E1, E2 and E3 values before comparing the combined lines. A mismatch in the first component points to source, seed or history differences; a later mismatch points to a cascade or weighting difference.
  • Read completed bars for a closed-bar comparison. An open candle changes the current source and both outputs. Higher-timeframe inputs can remain unconfirmed even after a lower-timeframe chart candle closes.
  • Record response time, peak overshoot and failed signal persistence separately. A longer TEMA period may reduce oscillation, but there is no single DEMA-to-TEMA period conversion that matches all price patterns and response measures.
  • If testing orders, specify entry, exit, equality handling, position sizing and fill timing. Hold commissions, slippage and evaluation dates fixed. Compare previously reserved data after parameter selection; an indicator-order comparison alone supplies no profitability evidence.

Turn the chosen calculation into an inspectable script

The Pine Script AI Coding Agent can draft code from your explicit indicator or strategy rules. Request shared source and length inputs, visible EMA components, a DEMA/TEMA selector and your chosen closed-bar signal definition. Ask it to check syntax, then compare the output against hand-calculated values and TradingView before evaluating trades.

  • Include the seed and synthetic sequence when requesting a reproduction of these tables. A script using ordinary chart history will not begin with the same states unless that initialization is specified.
  • A syntax check does not prove that the formulas, signal rules or fills match your intent. Review those separately. The workflow concerns code you can inspect and does not imply access to proprietary scripts, account migration or automatic trade execution.
Where Pineify fits

Pine Script AI Coding Agent

Draft your DEMA/TEMA comparison with explicit inputs and signal rules, request a syntax check, and inspect the generated Pine Script.

Draft a DEMA/TEMA comparison

Frequently asked questions

Educational comparison, not investment advice. The synthetic prices and calculated responses are not backtests, live results or evidence of profitable trading. Generated scripts and trading rules require independent review.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.