The stop distance is based on the real range, instead of a guessed fixed number of pips.
What is the ATR indicator?
It does not show direction, only how strongly the market is moving — the basis for a sensible stop-loss.
What is Average True Range?
Measures the market's average volatility as a smoothed average of the True Range.
Illustrative signals of the rule on simulated data — not a trading recommendation.
Rule: Price closes beyond the high/low of the previous 10 candles while ATR(14) rises: buy/sell in the breakout direction. Entry = close of the signal candle; SL = entry ∓ 1.5 × ATR(14); TP1/TP2/TP3 = 1R/2R/3R.
Where this indicator is strong
Three reasons Average True Range is still used after decades.
Knowing the range lets you convert it into a volume so each trade risks exactly the intended share of capital.
A very low ATR means the market is asleep; many systems stop trading during that phase.
How to read Average True Range signals
How Average True Range (ATR) produces its number, and what each shape on the chart means.
Formula and how it works
Each candle's True Range is the largest of three values: (high − low), |high − previous close|, |low − previous close|. ATR is the Wilder-smoothed average of the True Range over N periods. A high ATR means high volatility; ATR does not show direction, only the size of the moves.
Set Stop Loss and Take Profit as multiples of ATR to adapt to volatility; use ATR to filter out periods when the market is too quiet or too noisy.
Any context — ATR is a risk management tool, not a tool for finding entries.
Using ATR as a buy/sell signal. It contains no directional information, so on its own it never says buy or sell.
Keeping a fixed stop-loss distance while ATR has doubled. The trade then gets stopped out by the market's normal swings.
Recommended MT5 parameters for Average True Range
Default values of the sample file; test them for your market and timeframe.
| Parameter | Description |
|---|---|
| InpPeriod | True Range smoothing period (default 14). |
Put the indicator into MetaTrader 5
Four steps, no software needed besides MT5.
Click the download button above; the file saves to your computer under the indicator's name.
In MetaTrader 5 choose File → Open Data Folder, then go to MQL5/Indicators.
Open the file in MetaEditor and click Compile. No errors means the indicator is ready.
Go back to MT5, refresh the Navigator and drag the indicator onto the price chart.
DinexSpace wrote this file from the indicator's public formula, not from any commercial source. You are free to edit and reuse it.
How it differs from MetaTrader 5's built-in indicator
The short answer: the formula is not different. What differs is what you can do with it.
Average True Range here gives exactly the same number as MetaTrader 5's built-in version — on purpose. The four points below are what differs, and all four can be read from the very atr.mq5 you download.
- Calls a built-in indicator
- No — the calculation sits in
OnCalculateand can be copied straight into an EA - External libraries
- Not a single #import declaration
- Code length
- 53 lines · 1
inputparameters - How it draws
- A separate window below the price chart · calculated incrementally, does not redraw the past
Why this library promises no secret formula — read the full explanation on the library page.
Which indicators to pair Average True Range with, and what you gain
Each indicator only answers one question. Pairing well means covering the right weakness, not stacking more.
- What you gain
- The minimum pair for a trend system: the MA handles entries, ATR handles the stop distance and position size.
- Note
- This is the pair to build first. Without the sizing part, no signal, however good, becomes a system.
- What you gain
- Cross-checks two ways of measuring volatility. A squeeze with a low ATR means the market is truly compressed.
- Note
- Bollinger measures the standard deviation of the close, ATR measures the full candle range including gaps — two different numbers.
- What you gain
- Separates volatility from trend. A high ATR with a low ADX is a market that moves a lot but goes nowhere — the easiest phase to lose in.
- Note
- Neither indicator shows direction. This pair decides whether to trade, not whether to buy or sell.
Frequently asked questions about Average True Range
Does ATR give buy/sell signals?
No, and that is not a flaw. ATR only measures the size of the swings and contains no directional information at all. Its role is to set the stop-loss distance and position size for another system.
How many ATRs should the stop-loss be?
1.5 to 2 times ATR is the common range. Smaller and the trade gets stopped out by normal swings; larger and each losing trade costs too much. What matters is keeping the multiple fixed and adjusting position size to it.
Does Average True Range on this page use real or simulated data?
The chart on this page uses a deterministic simulated candle series; it is not market prices or trading results.
Using Average True Range in an EA, and further reading
State the candle-close condition, parameters and server time clearly when you put the rule into an EA. See the EAs available on the marketplace to compare options, or read how to read MT5 backtest results before judging any EA.
Other volatility indicators
Indicators in the same volatility group, often used instead of or alongside Average True Range.
An indicator draws signals, but when to enter, where to stop out and how much to risk are still your set of rules. Send those rules and DinexSpace builds them into an EA.