The atr trend indicator holds a direction until price proves otherwise. A close has to clear an EMA by a full ATR multiple before the state changes, which filters out the small crosses a bare moving average would react to. Trend up and Trend down colour the result.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from XAUUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 4: Trend up, Trend down, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 10 |
What the Atr trend Indicator draws on the chart
Trend up (lime green) carries the line while the state reads long.
Trend down (red) takes over once the state flips short.
Buy (lime, code 233) sits under the low on the bar where direction turns up.
Sell (red, code 234) sits above the high on the opposite turn.
- Trend up: line, lime green, width 2
- Trend down: line, red, width 2
- Buy: arrow, lime, width 3, arrow code 233
- Sell: arrow, red, width 3, arrow code 234

How the Atr trend Indicator calculates its values
The envelope
Two readings feed each bar: an exponential average over EmaPeriod and an ATR over AtrPeriod. Multiplying that ATR by Mult gives the distance either side of the average.
So the envelope is the EMA plus and minus one ATR multiple. Neither edge appears on the chart; both exist purely to decide the state.
State that persists
Direction carries forward from the previous bar unless a close breaks out of the envelope. A close above the upper edge sets it long, and a close below the lower edge sets it short.
Anything in between leaves the state untouched. Price can wander across the EMA repeatedly without changing anything, which is the whole point of the envelope.
Marking the flip
The code compares the current state against the previous bar. A change from short to long drops a Buy arrow, and the reverse puts up a Sell.
ArrowOffsetPoints sets the gap from the candle, multiplied by the symbol point size, and never affects the state.
How to read the signals
Colour is the state and an arrow is the change. Long lime stretches mean price never closed past the far edge.
The line follows the EMA, so it keeps moving while the state holds.
A flip needs a decisive close, not a touch. Wicks through the envelope leave the state alone.
Raising Mult widens the envelope and makes flips rarer, at the cost of a later turn.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Alerts cover popup, push, email and sound on each direction flip. A bar time check keeps it to one alert per closed bar.
Every Atr trend Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
EmaPeriod |
EmaPeriod is the average the envelope is built around. It defaults to 50. | 50 |
AtrPeriod |
AtrPeriod is the volatility window setting envelope width, 14 by default. | 14 |
Mult |
Mult is how many ATRs a close has to clear before the state changes. It defaults to 1.0, and raising it towards 2.0 makes flips much rarer. | 1.0 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPoints |
ArrowOffsetPoints is the cosmetic gap between an arrow and its candle, 30 points by default. | 30 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
(see inputs panel) | on |
EnablePopup |
(see inputs panel) | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
The screenshot uses XAUUSD H1. Scaling the envelope by ATR is what lets one Mult travel from a metal to a currency pair without retuning, since gold moves far more in absolute terms than EURUSD does. H1 and H4 give flips that last long enough to matter. On M5 even a full ATR clears often.
When the Atr trend Indicator fails
The envelope has no ratchet. It rides with the EMA, so it can move back towards price during a pullback rather than holding its ground.
ATR rises after a fast move, which widens the envelope exactly when the market has already become volatile.
A close just past the edge counts the same as a close far beyond it. There is no measure of how decisive the break was.
Direction seeds as long on the first calculated bar, so the leftmost part of a fresh chart can show a state price never earned.
Copy the compiled Atr 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 Atr trend Indicator: ATR Trailing Stops at StockCharts ChartSchool, Currency strength on Wikipedia.
Download the Atr trend Indicator for MT4 and MT5
The zip holds the compiled Atr 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.
FAQ
What does Mult 1.0 require before the state flips?
A close has to finish a full ATR reading beyond the EMA, measured over AtrPeriod bars. A close that merely crosses the average changes nothing. Raising Mult towards 2.0 demands a much larger move and cuts the number of flips sharply.
Are the Mult envelope edges drawn on the chart?
No. This build declares four plots: the two coloured trend lines and the two arrows. The upper and lower edges exist only inside the calculation to decide the state, so you see the result rather than the boundary that produced it.
Does the EmaPeriod envelope ratchet like a trailing stop?
No. A trailing stop only moves in the direction that tightens it. Here the envelope rides with the EMA and can move back towards price during a pullback. It filters entries into a state rather than protecting a position.
Why does EmaPeriod 50 suit XAUUSD H1?
Fifty bars on H1 covers about two trading days, long enough that gold intraday swings do not flip it constantly. The ATR term does the heavy lifting though, since it scales the required move to whatever the instrument is currently doing.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Atr trend Indicator as one input. Always backtest before trading live.
Category: this is part of our Trend collection. Then, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in ATR Trailing Stops at StockCharts ChartSchool.
- Additional market context is at Currency strength on Wikipedia.
