Triple Exponential Moving Average Indicator: TEMA At 50

Written by Dominic Walsh · Published · Last updated

The triple exponential moving average indicator fights lag with arithmetic. Three averaging stages run in sequence. Combining them with the formula Patrick Mulloy published cancels most of the delay a single average carries.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: TEMA Up, TEMA Down, TEMA Buy, TEMA Sell
Alerts popup, push notification, email, sound
Inputs 12

What shows up when you attach it

`TEMA Up` runs dodger blue while the line rises.

`TEMA Down` runs orange red while it falls.

`TEMA Buy` and `TEMA Sell` mark price crossing the line.

Marks sit `ArrowOffsetPips` `0.6` pips from the candle.

  • TEMA Up: line, dodger blue, width 2
  • TEMA Down: line, orange red, width 2
  • TEMA Buy: arrow, lime, width 2, arrow code 233
  • TEMA Sell: arrow, red, width 2, arrow code 234
Triple exponential moving average indicator coloured line and marks on EURUSD H1.
Triple exponential moving average indicator coloured line and marks on EURUSD H1.

From bar to value

Three stages, one formula

An average runs on price. A second runs on that result. A third runs on the second. Combining them as three times the first, less three times the second, plus the third is what removes the lag.

Slope sets the colour

`ColorFlip` `true` compares the line against its previous value. Rising sends it to one buffer and falling to the other, so the colour change is a statement about the line.

Crossings fill the marks

A buy needs the previous close at or below the line and the current close above it. `SignalCooldownBars` `3` then blocks another mark for three bars.

Making the output useful

A fifty-bar TEMA reacts closer to a twenty-bar plain average.

Reduced lag comes with more overshoot after a sharp move.

Colour and arrows answer different questions, so they can disagree.

`ShowArrows` clears the marks when you want the line alone.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`EnableAlerts` sits above every crossing alert and starts true with `EnablePopup`. Set `EnablePushNotify` for a phone buzz, `EnableEmail` for mail, or `EnableSound` to play `SoundFile`. Those three arrive false. One report per closed bar.

Every Triple Exponential Moving Average Indicator input

Core settings

Setting What it does Default
MAPeriod TEMA period (each EMA stage). Bars in each of the three stages, default `50`. 50
PriceMode applied price for the source. Price the first stage reads, default `PRICE_CLOSE`. PRICE_CLOSE
SignalCooldownBars bars to wait between arrows. Bars before another mark, default `3`. 3

Display settings

Setting What it does Default
ColorFlip recolour line on slope flip. Recolour the line on a slope change, default `true`. on
ShowArrows draw price/TEMA cross arrows. Draw the price crossing marks, default `true`. on
ArrowOffsetPips arrow gap from the candle. Pips between a mark and the candle, default `0.6`. 0.6

Alert settings

Setting What it does Default
EnableAlerts One switch above every crossing alert, default `true`. on
EnablePopup Dialog box when price crosses the line, default `true`. on
EnablePushNotify Phone buzz when price crosses the line, default `false`. off
EnableEmail Email when price crosses the line, default `false`. off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Triple exponential moving average indicator inputs panel with MAPeriod and ColorFlip.
Triple exponential moving average indicator inputs panel with MAPeriod and ColorFlip.

What to run it on

A fifty-bar setting needs history behind it. EURUSD H1 is the reference chart, where the line turns every few days. On M5 the reduced lag shows most clearly. Daily bars make it a long-term trend line.

When not to trust the output

Less lag means more reaction to a spike that goes nowhere.

Three stages need a long warmup before the line settles.

A price crossing on a fifty-bar line is still a slow event.

Copy the compiled Triple Exponential Moving Average Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Related on forexmt4systems.com: Moving Average Crossover Strategy.

Download the Triple Exponential Moving Average Indicator for MT4 and MT5

The zip holds the compiled Triple Exponential Moving Average Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does the TEMA formula actually do?

It takes three times the first stage, subtracts three times the second and adds the third. Each subtraction removes part of the delay the stage before it introduced, which is where the reduced lag comes from.

Why does MAPeriod 50 still react quickly?

Because the three stages cancel most of the lag between them. A fifty-bar TEMA turns closer to when a twenty-bar plain average would, while still smoothing like the longer setting.

What does turning ColorFlip off cost?

Whether the line recolours on a slope change. With it off the whole line uses one buffer, so you lose the visual direction cue but keep exactly the same values underneath.

Does SignalCooldownBars 3 apply per side?

It blocks another mark for three bars after one prints. Price hovering right at the line would otherwise cross repeatedly, and each crossing would earn its own arrow.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Triple Exponential Moving Average Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment