ATR Indicator: One Line That Measures Range, Not Trend

Written by Dominic Walsh · Published · Last updated

The atr indicator answers a question about size, not direction. How far does this instrument typically travel in a bar? Welles Wilder built the measure to size stops, and it still does that job better than anything simpler.

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 Separate window
Plots 1: ATR
Alerts popup, push notification, email, sound
Inputs 7

What the ATR Indicator draws on the chart

One dodger blue `ATR` line sits in its own pane.

The scale is in price units, so it changes with the instrument.

No levels, no marks and no second line ship here.

The line never goes negative, since range cannot be.

  • ATR: line, dodger blue, width 2
Atr indicator range line in its own pane on the XAUUSD H1 chart.
Atr indicator range line in its own pane on the XAUUSD H1 chart.

How the ATR Indicator calculates its values

True range covers gaps

True range is the largest of three distances: this bar’s high to low, its high to the previous close, and its low to the previous close. The last two are what make a gap count.

Then an average smooths it

iATR averages that value across `AtrPeriod` `14` bars using Wilder’s own smoothing, which weights history more heavily than a simple average would.

Why direction never enters

Every distance in the calculation is absolute. A bar that falls hard and one that rises hard produce the same reading. That is deliberate, because the measure exists to size risk.

How to read the signals

A rising line means bars are getting bigger, whichever way they point.

A falling line means the market is quieting down.

Compare the reading against its own history, never against another symbol.

The screenshot note picks XAUUSD H1 because gold shows expansion clearly.

Alert channels in this build: popup, push notification, email and sound.

`EnableAlerts` sits above the routes and ships true with `EnablePopup`. `EnablePushNotify` reaches a phone, `EnableEmail` sends mail and `EnableSound` plays `SoundFile`. Unlike most builds here, no once-per-bar guard applies, so messages can repeat.

Every ATR Indicator input

Core settings

Setting What it does Default
AtrPeriod Bars in the average, default `14`. 14

Alert settings

Setting What it does Default
EnableAlerts Top switch across the routes, default `true`. on
EnablePopup Dialog inside the terminal, default `true`. on
EnablePushNotify Notification to a phone, default `false`. off
EnableEmail Delivery by mail, default `false`. off
EnableSound Playback of a clip, default `false`. off
SoundFile Which clip that is, default `”alert.wav”`. alert.wav
Atr indicator inputs panel showing AtrPeriod and the alert switches.
Atr indicator inputs panel showing AtrPeriod and the alert switches.

Settings that fit your chart

The reading is in price units, so it means different things per instrument. The screenshot note picks XAUUSD H1, where gold expands and contracts visibly. EURUSD H1 gives a much smaller number for the same idea.

When the ATR Indicator fails

The value is absolute, so you cannot compare gold against a currency pair.

Wilder smoothing reacts slowly, so a sudden calm takes bars to show.

This build has no once-per-bar guard, so alerts can repeat within a bar.

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

Download the ATR Indicator for MT4 and MT5

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

How does AtrPeriod 14 smooth range?

Fourteen bars of true range, using Wilder’s smoothing rather than a plain mean. Fourteen is his original figure. Shortening it makes the line react faster to a change in conditions and noisier with it.

Why does true range include the previous close?

So a gap counts. If price opens well above yesterday’s close, the bar’s own high to low understates how far the market actually travelled. Measuring to the previous close captures that jump.

Can the ATR line tell me direction?

No, and that is by design. Every distance in the formula is absolute, so a hard fall and a hard rally read the same. Pair it with a directional tool if you need both answers.

How do traders use AtrPeriod for stops?

A common approach sets the stop at some multiple of the current reading, so it widens in fast conditions and tightens in quiet ones. The multiple is a personal choice this tool does not make for you.

Are results guaranteed?

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

Category: this is part of our Volatility collection. Thus, truly, yet, browse more Volatility 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