EMA Trend Indicator: Five-EMA Ribbon with On-Chart Verdict

Written by Dominic Walsh · Published · Last updated

The ema trend indicator puts five exponential moving averages on one chart and then tells you what their order implies. Periods run 10, 20, 50, 100 and 200, drawn fastest to slowest in distinct colours. A corner label reads the three fastest and reports up, down or flat. You get a verdict without squinting at which line sits on top.

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 7: EMA 10, EMA 20, EMA 50, EMA 100, EMA 200, Buy, Sell
Alerts popup
Inputs 14

What the EMA Trend Indicator draws on the chart

EMA 10 in dodger blue, EMA 20 in aqua and EMA 50 in gold drive the verdict.

EMA 100 in orange and EMA 200 in crimson add longer context, with EMA 200 drawn thickest.

Buy prints a lime arrow under the bar where the classification turns up.

Sell prints a red arrow above the bar on a turn down.

A chart label object shows the current TREND state in whichever corner you pick.

  • EMA 10: line, dodger blue, width 2
  • EMA 20: line, aqua, width 2
  • EMA 50: line, gold, width 2
  • EMA 100: line, orange, width 2
  • EMA 200: line, crimson, width 3
  • Buy: arrow, lime, width 3, arrow code 233
  • Sell: arrow, red, width 3, arrow code 234
EMA trend indicator on EURUSD H1 showing the five-line ribbon and the corner verdict
EMA trend indicator on EURUSD H1 showing the five-line ribbon and the corner verdict

How the EMA Trend Indicator calculates its values

Five straightforward averages

Each buffer takes a plain iMA call on the close with MODE_EMA, using `InpFastEMA`, `InpMidEMA`, `InpSlowEMA`, `InpVerySlow` and `InpBaseline` in turn. No smoothing, weighting or adaptation sits on top. Each line waits until enough bars exist behind it, which the code checks with a guard such as i + InpFastEMA < rates_total.

Turning the stack into a verdict

A helper called ClassifyTrend reads the three fastest values and returns one state. A clean stack in period order gives up or down. Anything tangled gives flat. The corner label displays that single number, coloured through `InpUpColor`, `InpDownColor` or `InpFlatColor`.

Marking a change of state

The code calculates the previous bar’s classification the same way, as trend_prev. When the current bar’s state differs, it writes an arrow: BuyArrow at low[i] minus 8.0 points, SellArrow at high[i] plus the same. That offset lives in the code rather than an input, so arrows always keep the same distance from the candle.

How to read the signals

Cleanly separated lines in period order give the clearest state the ribbon can show.

Lines twisted together produce the flat verdict, and that is usually the honest answer in a range.

The arrow marks the bar where the verdict changed, not where any single crossover happened.

EMA 200 supplies context only. It takes no part in the classification.

Alert channels in this build: popup, one message per closed bar.

One channel exists, a terminal popup, and it ships switched off: `InpEnableAlerts` defaults to `false`. Turn it on and you get a message when the trend classification changes, held until the bar closes so a mid-bar reorder stays silent.

Every EMA Trend Indicator input

Core settings

Setting What it does Default
InpFastEMA Fast EMA period. Fastest line, default `10`, and one of the three that decide the label. 10
InpMidEMA Mid EMA period. Middle line, default `20`. 20
InpSlowEMA Slow EMA period. Third classifier line, default `50`. Widening this gap makes the verdict slower and steadier. 50
InpVerySlow Very slow EMA period. Context line, default `100`, which never enters the verdict. 100
InpBaseline Baseline EMA period. The `200` period line, drawn thickest as the long term reference. 200

Display settings

Setting What it does Default
InpShowLabel Show TREND label. Turns the corner readout on and off. `InpLabelCorner` picks which corner it uses. on
InpLabelCorner Corner (0..3). 1
InpLabelXOff Label X offset (px). 12
InpLabelYOff Label Y offset (px). 24
InpLabelSize Label font size. 14
InpUpColor Up-trend text color. lime
InpDownColor Down-trend text color. red
InpFlatColor Flat text color. silver

Alert settings

Setting What it does Default
InpEnableAlerts Alert on trend change. off
EMA trend indicator inputs with InpFastEMA, InpBaseline and the label controls
EMA trend indicator inputs with InpFastEMA, InpBaseline and the label controls

Settings that fit your chart

A 10, 20 and 50 stack is a common trend read on H1 and H4, and EURUSD H1 is the reference chart. The 200 period line covers roughly eight days of H1 bars, a useful long reference. On M1 the five lines bunch together and the verdict sits on flat most of the time. On the daily chart the ribbon separates cleanly but changes state only a handful of times a year.

When the EMA Trend Indicator fails

Every line lags, and stacking five of them changes nothing about that. The verdict confirms a trend well after it began.

Choppy conditions leave the fast three tangled, so the label reads flat and the tool gives you nothing actionable for long stretches.

A gap or a news candle can reorder the fast lines for one bar and produce an arrow that reverses immediately.

Copy the compiled EMA Trend 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.

Background reading on the method behind the EMA Trend Indicator: Foreign exchange fraud on Wikipedia, Dow Jones Select Indices at StockCharts ChartSchool.

Download the EMA Trend Indicator for MT4 and MT5

The zip holds the compiled EMA Trend 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

Which EMAs decide the TREND label?

Only the three fastest: `InpFastEMA` at `10`, `InpMidEMA` at `20` and `InpSlowEMA` at `50`. ClassifyTrend reads those three and returns up, down or flat. EMA 100 and EMA 200 appear for context and never enter the calculation, which is why the label can read up while price sits below the crimson line.

Why does InpEnableAlerts default to false?

The classification changes fairly often on lower timeframes. Shipping it off avoids a stream of popups on a chart you have only just opened. Switch it on in the inputs panel once you have settled on a timeframe and confirmed the arrow frequency suits how you trade.

Can I move the TREND readout?

Yes. `InpLabelCorner` takes 0 to 3 and defaults to `1`. `InpLabelXOff` and `InpLabelYOff` nudge it in pixels from that corner, at `12` and `24`, and `InpLabelSize` sets the font at `14`. Use them when the label lands on top of your broker’s own chart furniture.

What makes the EMA 10, EMA 20 and EMA 50 order read flat?

Any order of those three that is not a clean stack. When EMA 20 sits above EMA 10 while EMA 50 falls between them, no consistent direction exists to report. Ranges produce this constantly. The tool is describing an unclear chart accurately rather than failing at its job.

Are results guaranteed?

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

Category: this is part of our Trend collection. Also, truly, 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