$ £ ¥
¥ £ $

How to Automate Trailing Stop-Loss in MetaTrader with EA?

Table of contents

A trailing stop is one of the most sought-after tools by Forex traders who practice risk management. It is an important part of many strategies and works to limit losses and secure profits. Trailing stop means moving the stop-loss level in the direction of the trade according to specific rules. You can automate this task through a trailing stop EA in MetaTrader.

What Is Trailing Stop-Loss?

So what exactly is a trailing stop?

A trailing stop is the short for trailing stop-loss — it is the activity of moving the stop-loss price when the current price moves in favor of your trade.

Say, for example, you open a long (buy) position in EUR/USD at the price of 1.1200 and you set the stop 20 pips away (1.1180).

The price then moves to 1.1220, and you move the stop-loss to 1.1200 (breakeven).

The price moves again to 1.1240 without hitting your stop, and you move the stop to 1.1220.

You are basically applying a trailing stop. You are moving the stop-loss following the price, until the price eventually hits your take-profit target or your stop-loss.

How Automatic Trailing Stop-Loss Expert Advisors Work in MT4

As you will see further in this guide, there are several types of trailing stops.

You can apply a trailing stop by following an indicator or by following a fixed distance from the current price.

There are several expert advisors (EA) that can automate this process in MetaTrader.

Why Use Trailing Stop?

Using a trailing stop is a very common practice both with beginners and among experienced traders.

It is often required by the risk management rules of popular trading strategies.

The main benefits of applying a trailing stop to your trades are:

  • If the trade is still in loss, you can limit your losses.
  • When the trade is profitable, you can secure profits.
  • It can replace a take-profit level to capture profits in run-away trends.

Do not underestimate the power of a trailing stop because it can be the difference between a losing and a profitable strategy.

Difference Between Trailing Stop and Stop-Loss

Trailing Stop and stop-loss are closely related but there is a key difference between them.

A stop-loss price is a price recorded in the trade that when hit will immediately close the trade.

A trailing stop is the activity of updating the stop-loss price when the price moves in favor of the trade.

It is very important to understand that the two are executed by MetaTrader differently.

A stop-loss price is registered on the server together with the trade, so if that price is hit by the current price the server closes the trade.

A trailing stop, on the other hand, is performed on the client side. This means that you configure it on your terminal, and your terminal must be open to update the stop-loss price.

In other words, you cannot have a trailing stop working without having your MetaTrader software running.

This is why, it is best to use a VPS server to run a trailing stop for you.

How to Enable Trailing Stop in MT4?

At this point, you should understand fairly well what a trailing stop is and why you should use it.

MetaTrader platform offers a very simple trailing stop option that you can enable.

To set an auto trailing stop in MT4, right-click on a trade line directly on the chart or on a trade entry in the Trade tab of the Terminal panel.

You will see a Trailing Stop option property that expands into some settings.

With that option, you can set the number of points of distance between the current price and the stop-loss price.

Enabling Trailing Stop in MetaTrader

Once this is set, your MT4 client will move the stop-loss by following the current price when it moves in the trade's direction, keeping the distance equal to the number of points you set.

For example, you set a trailing stop of 100 points (which is the same as 10 pips for quotes with 5 decimal places) on a long position EUR/USD opened at 1.12000.

If the price goes to 1.12050, the stop-loss will follow to 1.11950.

If the price grows again to 1.12100, the stop-loss will follow to 1.12000, keeping the distance of 10 pips.

If the price moves back to 1.12030, the stop will stay at 1.12000 because the price moved against the trade.

So, as you can see, the trailing stop acts as a backstop for a trade.

How to Enable Trailing Stop in MT5?

To enable an automatic trailing stop mechanism in MT5, the process is the same as in MT4.

Right-click on a trade line directly on the chart or on an order entry the Trade tab of the Terminal panel.

MT5 will trail the stop-loss by following the price at a distance equal to the number of points you set.

Auto Trailing Stop EA in MetaTrader 4

The auto trailing stop facility in MetaTrader is too limited. It is too basic and lacks some important features.

It would benefit greatly from functions like:

  • Ability to apply trailing stop to selected trades only.
  • Filtering the trades for trailing stop by magic number.
  • Filtering the trades for trailing stop by order comment.
  • Send a notification whenever a stop-loss is updated.
  • Ability to use more complex functions or indicators to trail a stop-loss.

There are many expert advisors that can assist with a trailing stop with extended functionality.

Further below, you will find some popular trailing stop methods along with working trailing stop expert advisors for MT4 trading platform.

How to Move Stop-Loss to Breakeven?

A very simple form of a trailing stop is to move the stop-loss to breakeven, i.e. the open price.

This can be done when the current price is at a specified minimum distance from the open price.

For example, you want to move the stop-loss to breakeven when the price is 50 pips above your buy order open price.

Such a trailing stop only acts once. It moves the stop-loss to breakeven and then ceases operation.

Moving Stop-Loss to Breakeven

Move Stop to Breakeven is a free MT4 expert advisor that can automatically move your stop-loss to breakeven according to your settings.

Trailing Stop Using MA

A moving average indicator can be an indicator that you can use as a trailing stop.

Trailing Stop-Loss Using Moving Average

Moving Average Trailing Stop is a free customizable MT4 expert advisor that makes the stop-loss follow the moving average line.

Trailing Stop Using Fixed Step

This type of a trailing stop is similar to the one that you can set in MetaTrader, but it only triggers at specific steps.

For example, you could set a trailing stop that incremented every 20 pips. A long position in EUR/USD open at 1.1200 and with original stop at 1.1180, with a 20 pip fixed step trailing stop would act the following way:

When the price goes to 1.1220, the stop is moved to 1.1200. When the price goes to 1.1240, the stop goes to 1.1220, and so on. The stop-loss doesn't move until the current price goes up the next 20 pips.

The stop-loss is moved only at specific steps. Basically, if you draw a grid of horizontal lines with distance equal to the step size, you will see the trailing stop applied at each next line of the grid.

Trailing Stop Using Fixed Step Increments

Fixed Step Trailing Stop is a free MT4 expert advisor that can automate the fixed step stop-loss incrementation for you.

Trailing Stop Using ATR

ATR stands for average true range indicator. It is a very popular utility metric that traders use to assess the market's volatility. ATR tells you how volatile the price has been during the recent N candles.

You can use this indicator to set a stop-loss and as a trailing stop. For example, if you see an ATR value of 30, you can expect the price to have a range of 30 pips on average during the current candle. This can help you setting a volatility-based stop-loss. Your trailing stop can be based on this value too.

ATR Trailing Stop is a free MT4 expert advisor that uses ATR values to automatically trail a stop-loss according to your input parameters.

Trailing Stop Using PSAR

Parabolic SAR (or PSAR) is another indicator that can act as a foundation for a sound trailing stop.

However, it might be more suitable during strong moves and defined trends. It is probably not the best choice of a trailing stop for ranging markets.

Parabolic SAR Based Trailing Stop Explained

PSAR Trailing Stop is a free MT4 expert advisor that uses PSAR indicator values to update stop-loss levels of your selected trades.

Trailing Stop Using Supertrend

Supertrend is one of the traders' favorite custom indicators for MT4. It also happens so that this is one of the most suitable indicators for trailing stop.

Supertrend has only a few options and can follow the trend pretty well. Because if this, it can quickly react to trend reversals, making it an ideal solution for a trailing stop.

Trailing Stop Using Supertrend

Supertrend Trailing Stop is a free MT4 expert advisor that uses Supertrend indicator to automatically trail a trade's stop-loss.

Trailing Stop Using Fractals

Fractals is another popular indicator that can provide a decent trailing stop value.

As you can see, the arrows placed by the fractals indicator can be good levels for a stop-loss in a trending market.

Trailing Stop Using Fractals

Fractals Trailing Stop is a free MT4 expert advisor that uses Bill Williams' Fractals indicator to automatically trail your stop-loss values.

Trailing Stop Using High/Low

In some cases, a conservative trailing of a stop order can be performed using recent higher highs or lower lows.

As is the case with other trailing stop methods, trailing stops to high/low values is better done automatically by trading software rather than manually by the trader.

High/Low Trailing Stop is a free MT4 expert advisor that detects the higher highs and lower lows for the past N candles and trails the stop orders of your trades automatically.

Trailing Stop on Profit

Some traders prefer their trailing stop to activate only upon the trade getting into the profit zone.

This automatic EA will do just that — it will activate the classic trailing stop function once your trade reaches a given level of profit.

Trailing Stop on Profit is a free MT4/MT5 expert advisor that gradually trails the stop orders of your trades once they attain a given number of points of profit.


In this guide, you have learned about the concept of trailing stop and its importance in risk management. You have also found out how to automate your trailing stop process in MetaTrader via expert advisors.