Category
Risk
Difficulty
Beginner
Used in
Risk managementMT5 operationStrategy design

Stop-loss

A stop-loss is a price level attached to a position at which the broker closes it automatically, capping the loss on that trade. It lives on the broker's server, so it works even when the terminal does not.

also: SL, hard stop, protective stop

Updated · Reviewed

In plain English

The price at which you have agreed in advance to be wrong. Setting it turns an open position into a known cost.

Why it matters

A stop-loss fixes the worst case before the market gets a say. Position size, risk/reward and expected drawdown all follow from that one distance. Without it a strategy reports the losses that closed, not the losses it can take.

  • It converts risk into arithmetic. A stop distance plus a risk limit produces a lot size; without it there is nothing to size against.
  • It sits on the broker's server once set, so it fires while the terminal is shut or the VPS reboots.
  • Its absence leaves the worst case unbounded. Grid and martingale recovery omit it, which is why those curves look calm until they do not.

In MetaTrader 5

Where it appears in MT5

  • New Order dialog (F9) → Stop Loss — set at entry, in price terms rather than pips
  • Toolbox → Trade tab → right-click a position → Modify or Delete Position
  • Market Watch → right-click the symbol → Specification — the Stops level row holds the minimum distance this broker accepts
  • Toolbox → Journal — where an invalid-stops rejection surfaces, not the Experts tab
  • Strategy Tester → Inputs — a stop is an input like any other, so the optimiser fits it to your history

How EAs use it

  • Set at entry in the same MqlTradeRequest as the order. The sl field carries a price, not a distance, so the EA converts pips itself.
  • Attached afterwards with TRADE_ACTION_SLTP, or CTrade::PositionModify(), when the strategy needs the fill price first.
  • A fixed distance is what usually ships: none of the 27 records published here derives its stop from ATR.
  • Brokers reject a stop closer to price than SYMBOL_TRADE_STOPS_LEVEL. The EA must handle that rejection, not assume the stop landed.

Typical settings

Setting Typical value Note
ATR multiple (volatility stop) 1.5–2.5 × ATR(14) A recommendation, not a census — no record here is set this way. Below 1.5 the stop sits inside ordinary movement.
Shipped stop, 16 single-stop EAs here 25–114 pips, median 100 What these builds actually send. Five of the sixteen ship exactly 114.
Risk per trade 0.5–2% of balance This and the stop distance fix the lot size. Choosing lot size first inverts the logic.
Minimum distance from price broker's stops level Market Watch → Specification prints it. A stop inside it never reaches the server.
Break-even move after 1 × the stop distance in profit Common, and not free: it turns some winners into scratch trades on a retrace.

Common operational problems

  • The order fills, the stop comes back rejected for sitting too close to price, and the position runs bare behind one journal line.
  • The EA computes the level from the requested price rather than the fill price, so slippage shifts the real risk.
  • Points and pips collide on 5-digit quotes: a 30-pip stop goes out as 30 points.

Related MT5 functions

MqlTradeRequest.sl
The stop price sent with the order; zero means no stop.
SymbolInfoInteger(symbol, SYMBOL_TRADE_STOPS_LEVEL)
Minimum points between price and a stop, below which the broker rejects it.
SymbolInfoInteger(symbol, SYMBOL_TRADE_FREEZE_LEVEL)
Distance within which the server refuses to modify or close an order.
PositionGetDouble(POSITION_SL)
Reads back the stop in force — the check that the server took it.

Example

Nobody picks a stop distance alone. It goes with the risk limit, and the pair produce the lot size.

Account balance
$10,000
Risk per trade
1% = $100
Stop distance
40 pips
Resulting position size
0.25 lots
About $10 per pip per lot on a major pair.

Widen the stop to 80 pips and the size must halve to 0.125, or risk doubles.

Calculation 100 ÷ (40 × 10) = 0.25 lots

Result A 40-pip stop costing exactly $100 if it is hit

How it is used

Read a stop as a pair — the distance and the size that goes with it. Either alone says nothing about the risk.

Range What it means
Stop inside 1 × ATR Ordinary movement closes the trade; the win rate falls for reasons unrelated to entry.
1.5–2.5 × ATR, size adjusted Outside the noise, and sized so being wrong costs a planned amount.
Wide stop, unchanged lot size Risk per trade grew in proportion to the widening.
No stop at all The worst case is the account; drawdown covers only the losses that closed.
  • Read POSITION_SL back after the fill. Assuming the server accepted the request is how positions run bare.
  • Count a loss by where price closed, not by what the account was debited: swap and commission make 207 of these lines money losses that price won.

Every EA here states its stop rule and publishes its trade ledger, so the realised loss sits next to the implied stop. The measured figures here come from those backtest ledgers (EXP-STOP-OVERSHOOT-001).

Common mistakes

Moving the stop away from price to avoid taking the loss

The one modification that turns a controlled loss into an uncontrolled one. Every risk figure on the account rested on that number.

Believing a stop fixes the exit price

It is a trigger, not a promise: gaps fill through the level and the position closes at the next available price. A stop-limit fixes the price instead, at the risk of no fill; MT5 offers one, MT4 does not.

Using a fixed pip stop across regimes

Thirty pips is generous in a quiet market and inside a single bar in a volatile one.

Setting the stop where the account can afford it

A stop placed at the distance a too-large position tolerates sits inside the noise. The size should give way.

In depth

What 2,719 published losing trades did to the level meant to stop them

Every listing ships its closed-trade list, so each exit distance sits beside the stop it carries. Sixteen of the 27 records send one distance on every order; a loser below means price closed against the entry.

16 uniform-stop records, 2,719 losing tradesFigure
Losses closing within ±2% of the shipped stop81.98% (2,229)
Losses closing past it4.34% (118)
Records whose deepest loss beat the setting by half again9 of 16
Median deepest overshoot per record55.65%
Deepest single loss316.6 pips against a 114-pip stop
Friday entry, non-Friday close: all losses vs overshoots12.69% vs 18.64% (22)

Row one is the stop working: four losers in five land on the preset’s number. Row two is the part no setting controls. The last row is thinner than it looks: count every hold spanning a Saturday or Sunday instead and the shares converge, 33.36% against 35.59%. Rows three and four are thin too: Sundial’s deepest loss, 39.0 pips against a 25-pip stop, is the only zero-elapsed row that is a loss, and dropping all three makes them 8 of 16 and 44.06%. Sundial’s timed close usually gets there first, median loss 8.1 pips — a faster exit moves the typical loss, not the worst.

One sizing rule follows: multiply the shipped stop by 1.56, the median worst case across these 16 records, before testing it against your per-trade limit; half beat it. Scale the distance from measured volatility, and read the stop any expert advisor ships off its own page in the catalogue.

Frequently asked questions

Should an MT5 EA always use a stop-loss?
Any EA whose risk you intend to quantify has to: position size, risk/reward and expected drawdown all follow from the stop distance. Grid and martingale recovery omit it, so their worst case has no bound.
What is a good stop-loss distance?
Far enough out that ordinary movement does not reach it — roughly 1.5 to 2.5 times ATR intraday. The pairing matters more: size the lot so being stopped costs a planned fraction of the account.
Does a stop-loss work if my computer is off?
Yes. Once accepted it sits on the broker's server and fires there, whether or not your terminal runs. A stop the EA manages in code needs the terminal alive.
Why was my stop-loss rejected?
Usually it sat closer to price than the symbol's stops level, published in the Specification dialog. Other causes: an invalid price for the direction, or a modification inside the freeze level.
How much worse than the stop can a loss get?
On the 16 single-stop EAs published here, the deepest loss in each ledger overshot the shipped distance by a median 55.65%. Nine of the sixteen took at least one loss half again wider than their setting.