Skip to content

Free MT5 Expert Advisor

Auto SL TP EA

MT5 utility that adds a stop-loss and take-profit to any position that has none, using points, ATR or an R multiple, with symbol and magic filters.

Risk managementv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Non-repainting signals Stop-loss on every trade
Strategy
Does not open trades. When it finds a position without a stop-loss or take-profit, it adds them at the configured distance from the open price.
Risk model
Opens no trades; makes sure every managed position carries a stop-loss and, optionally, a take-profit

What it does

Auto SL TP EA closes a common gap in risk control: a position opened in a hurry, from a phone, or by a signal service without a stop-loss. It checks every second and adds a stop and a target to any position that has none. It never opens or closes trades and never changes a stop or target that is already set.

How it works

For each open position (looped from last to first and selected by ticket) that passes the symbol and magic filters:

  1. If the stop is missing, a distance is calculated, either fixed points or ATR × multiple on the chosen timeframe, and the stop is placed that far from the open price.
  2. If price has already moved beyond that planned stop, the distance is measured from the current price instead (never closer than the broker's stops level), and the log says so.
  3. If the target is missing, it is placed from the open price by points, by ATR, or by R multiple × the stop distance. A target that price has already passed is not added.
  4. The broker's stops and freeze levels are respected. A failed modification is retried after 30 seconds.

The grace period lets you set your own levels first; the EA only acts if they are still missing after that time.

How to use it

Attach it to one chart. For account-wide protection, choose "All symbols". If you use EAs that add their stops a moment after entry, set a grace period of a few seconds, or limit the tool to manual positions with the magic filter. ATR mode adapts the stop to each symbol's volatility; points mode is predictable but must suit every symbol in scope.

Settings

InputDefaultWhat it changes
Add stop-losstrueAdds missing stops
Stop-loss modeATRPoints or ATR
Stop (points) / (x ATR)300 / 1.5Stop distance
Add take-profittrueAdds missing targets
Take-profit modeR multipleNone, points, ATR or R
Target points / ATR / R600 / 3.0 / 2.0Target distance
Grace period (seconds)0Delay before acting
ATR timeframe / periodchart / 14ATR source
Symbols / PositionsChart / AllScope

Limitations

A stop chosen by a fixed rule does not know your trade idea; it may be too tight or too wide for a particular setup. Between the open and the first check the position is unprotected, and nothing happens while the terminal is off. Points mode applied to many symbols can produce unsuitable distances, for example on gold versus EUR/USD.

Before you run it live

Open small manual trades on a demo account and check where the levels are placed for each symbol you use. Make sure the distances make sense with your position size, using the Position Size Calculator. Trading carries a substantial risk of loss.

Key inputs

Key inputs of Auto SL TP EA
InputDefaultDescription
Stop-loss modeATR multipleStop distance in fixed points or as an ATR multiple.
Stop (x ATR)1.5Stop distance in ATR mode.
Stop (points)300Stop distance in points mode.
Take-profit modeR multipleNone, fixed points, ATR multiple or a multiple of the stop distance.
Target (R)2.0Take-profit distance as a multiple of the stop distance.
Grace period (seconds)0Waits this long after a position opens before acting.
Symbols to manageChart symbol onlyChart symbol or all symbols.

Educational tools, not advice. Automated trading can lose money quickly. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 expert advisors