ATR Stop Loss Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The atr stop loss indicator answers a placement question rather than an entry one. Find the last swing low. Drop a multiple of the range reading below it. That is where a long stop sits without being clipped by ordinary noise, and the short line mirrors it above the last swing high.

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 2: Long SL, Short SL
Alerts popup, push notification, email, sound
Inputs 9

On the chart: plots and colours

Two lines and nothing else.

`Long SL` runs sea green under price.

`Short SL` runs fire brick above it.

Both step rather than slope.

Neither line carries an arrow.

The pane below price stays empty.

  • Long SL: line, sea green, width 2
  • Short SL: line, fire brick, width 2
atr stop loss indicator: Both stop lines stepping behind structure on XAUUSD H1.
Both stop lines stepping behind structure on XAUUSD H1.

How the Atr Stop Loss Indicator reaches a value

Finding structure

A fractal test does it. `SwingDepth` `5` bars either side must stay above a low before that bar counts as a swing. The most recent one then anchors the line.

Adding room

Structure alone sits too close. iATR at `AtrPeriod` `14` measures the usual bar range. `Mult` `1.5` of that reaches beyond the swing, and that gap is the buffer.

Why it steps

The anchor only moves at a new swing. Between swings the line drifts a little with the range reading. A fresh swing low jumps it to a new place.

How to take a reading

Each line marks where a stop would sit on this bar.

The two are independent, so both stay drawn at once.

A jump means a new swing point formed.

Widening gaps mean the market got noisier.

The lines are placement guidance, never an entry.

A quiet market pulls both lines closer to price.

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

`EnableAlerts` covers the tool’s messages and starts true with `EnablePopup`. `EnablePushNotify` reaches a phone, `EnableEmail` posts mail and `EnableSound` plays `SoundFile`. Those three arrive off.

Every Atr Stop Loss Indicator input

Core settings

Setting What it does Default
AtrPeriod Bars behind the range reading, `14`. 14
Mult Ranges of room past the swing, `1.5`. 1.5
SwingDepth Bars each side of a swing, `5`. 5

Alert settings

Setting What it does Default
EnableAlerts Master switch, `true`. on
EnablePopup Box in the terminal, `true`. on
EnablePushNotify Buzz on a phone, `false`. off
EnableEmail Mail from the tool, `false`. off
EnableSound Audio cue, `false`. off
SoundFile Which clip plays, `”alert.wav”`. alert.wav
atr stop loss indicator: Inputs panel with AtrPeriod, Mult and SwingDepth.
Inputs panel with AtrPeriod, Mult and SwingDepth.

Suitable charts

XAUUSD H1 is the reference chart, and gold shows the idea best. Its range swings enough that a fixed point stop would be wrong half the time. On EURUSD the lines sit tighter. On M5 the swings are too small to anchor much.

The rough edges

A swing needs five bars after it, so the anchor lags.

In a range both lines sit close and get hit often.

One outsized bar widens the buffer for fourteen bars.

Nothing here tells you which side to be on.

Copy the compiled Atr Stop Loss 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 Stop Loss Indicator: Average true range on Wikipedia, Stop Loss Order at BabyPips.

Download the Atr Stop Loss Indicator for MT4 and MT5

The zip holds the compiled Atr Stop Loss 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

Why does Mult 1.5 sit beyond the swing?

Because a stop exactly at a swing low rarely survives ordinary movement. One and a half average ranges of room clears the noise while still tying the level to real structure rather than to a fixed pip count.

What makes SwingDepth 5 confirm a point?

Five bars on each side staying above the low. That makes a ten-bar window in total, so the swing only counts five bars after it printed, and that delay is the price of the confirmation.

Why do the Long SL and Short SL lines step?

Because the anchor only changes when a new swing forms. Between swings the line drifts a little as the range reading moves, then jumps the moment a fresh swing point confirms.

Should AtrPeriod be shorter for scalping?

It can be. A shorter window tracks current conditions faster and pulls the lines tighter, at the cost of reacting hard to a single large bar. Fourteen is the balance Wilder settled on.

Are results guaranteed?

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

Category: this is part of our Volatility collection. Then, 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