Trailing stop: what is it and how does it work in trading on the MT4 / MT5 terminal


olegas Feb 27, 2021 / 76 Views

A trailing stop is a stop loss order that trails behind the price (which is why it is sometimes also called a trailing stop). This is a kind of script embedded in the trading terminal. It simply moves the price at which the position will be closed, following the price that moves in your direction. This is done in order to limit your losses in case the price turns around and goes to a loss.

Principle of operation

Trailing stop works according to the following algorithm:

  1. Until the price moves away from the Trailing Stop setting point by the distance specified in its settings (in the direction of profit, of course), the script does not take any action;
  2. When the profit in points reaches the value specified in the Trailing Stop, the script sends a signal to the terminal, which in turn sends the broker an order to place a Stop Loss order at the distance specified in the Trailing Stop.
  3. Next, when the profit increases by each point, orders are sent to the broker to move the established Stop Loss order so that it is located at a specified distance from the current price.
  4. If the profit decreases, no action is taken and if the price reaches Stop Loss, the broker will simply close the position.

Let's say you opened a long position on the EUR/CHF currency pair and placed stop loss and take profit orders. Then the price began to rise, bringing you some paper profit.

Paper is the trader's profit on an open position. Until the position is closed, the amount of paper profit can change as desired or turn into a loss (that’s why it is often called floating profit). After closing a position, the paper profit turns into the trader's real profit.

You decide that if the price turns down by more than 30 points, you will need to close the position, and set a trailing stop of 30 points. In this case, until the price rises by 30 points or more, the old stop loss order (which you set initially) will remain in place, and then the terminal will automatically begin to rearrange the order with each upward price movement. Those. when the price rises 30 points, the trailing stop will immediately drag the stop loss order to breakeven (at a distance of 30 points from the current price). When the price rises to 35 points, the trailing stop will drag the stop loss order to the level of plus five points, etc.

Of course, a trailing stop only drags the stop loss in the direction of your profit, that's the point. And when the price turns around and moves a specified number of points from the current local extremum towards a loss (in our example, 30 points), the position will close in profit.

In what cases is it used?

The use of Trailing Stop may be necessary in the following cases:

  1. With a strong price movement caused, for example, by the release of important economic news;
  2. When you don’t have time to constantly monitor an open position.

It should be remembered that Trailing Stop is a function of the trading terminal and only works when the terminal is turned on **. This means that if you install it, and after some time, for example, the Internet is lost, the stop loss order will remain at the level to which the trailing stop managed to move it before the connection between your trading terminal and the broker was disconnected.

** This applies to the most popular trading platforms such as MT4, MT5, Quik. However, there are also platforms that transfer the maintenance of the trailing stop to the broker’s server. These include, for example, the JForex platform from the Ducascopy broker.

If you are trading a pattern.

Let's say you are trading a double top, so you place a stop order here (1), if you trade a v-shaped reversal, you place a stop order here (2)

We place a stop order where the logic of our entry will be lost. The difficulty begins when volatility prevents you from entering.

Firstly, it must be said that we do not place our stop order tick by tick, always take it a little higher. When we set a shorter stop, there is a high probability that we will be taken out of the market.

Trailing stop in MT4

In the Metatrader 4 (MT4) trading terminal, the Trailing Stop function is implemented in just a couple of mouse clicks. In order to attach it to an open position, right-click on it and select “Trailing Stop” from the drop-down menu. Next, you just have to select the number of points expressing the distance at which the Stop Loss will move.

You can select the size of the sliding stop from the proposed values, or set your own value by clicking on the “Set level” button.

The MT4 trading terminal allows you to attach a trailing stop to both market and pending orders. We should not forget that the pending order is located on the broker’s server, and therefore, when the price reaches the specified value, it will open in any case (regardless of whether the trading terminal is on or off and the Internet connection). But the trailing stop will start working only when the terminal is running and connected to the Internet.

If you need to delete an established sliding stop, you should select “Delete all levels” or “Delete All” in the same menu.

Kinds

The most common types of trailing stops are absolute and percentage. However, trailing is a flexible tool, and there are many other options. Let's go through some of them.

Absolute and percentage trailing

The first, trailing by absolute values, we looked at in the example above. The second, percentage trailing, corresponds to the name - the distance here is measured not by specific numbers (for example, $200), but by percentages.

Percentage trailing is considered more stable in the face of price fluctuations, which is important for traders playing in the volatile crypto market. However, it all depends on what goals the user sets for himself.

ATR Trailing Stop

This type of trailing is based on the ATR, and has been known in the forex market since the 1980s.

ATR is an indicator of market volatility. In Russian its name sounds like “Average true range”.

ATR is one of the most effective indicators for stop loss, so using it in trailing is the right decision.

The average true range is based on three metrics:

  • the difference between the current minimum and maximum;
  • the difference between the previous closing price and the current low;
  • the difference between the previous closing price and the current high.

ATR Trailing Stop is part of a large group of trailing stops based on indicators. Among others, the most famous are trailing stops for fractals and parabolics. Both use similar mechanisms, so let's look at just one of them.

Parabolic trailing stop (PSAR)

Parabolic SAR, or simply PSAR, is an indicator similar to the moving average MA. Its peculiarity is the ability to change the position relative to the asset price. When an asset grows, it is located below prices, and when it falls, it is located above.

Example:

If a growing asset begins to decline, crossing the PSAR line, then a “reversal” of the indicator occurs. During a reversal, the indicator moves exactly to the opposite side of the price.

A PSAR reversal signals the end of the previous trend, in this case an uptrend, and the transition to a correction phase.

In MetaTrader 4 (MT4) and other programs used by traders, there are only two settings for parabolic trailing:

  • Distance Points: sets the distance for the stop loss;
  • Allow Loss: optional. If you enable this option, the trailing stop will continue to move even in a losing market.

Read more: Parabolic SAR - theory and practical application of the indicator.

Advantages and disadvantages of a trailing stop

The main advantages of this tool include the following:

  1. Automatic transfer of a Stop Loss order to the profit zone allows the trader (with proper use of this tool) to minimize losses and increase potential profits;
  2. Setting a trailing stop helps the trader relieve the emotional stress that inevitably arises when constantly monitoring an open position.

There are, of course, a number of disadvantages, the main of which include:

  1. Lack of flexibility, due precisely to the fact that Stop Loss is dragged strictly at a given distance. This, on the one hand, may not give the price the required freedom of movement, leading to premature closing of the position using a stop (at low Trailing Stop values). On the other hand, if the Trailing Stop value is too large, it can lead to the fact that most of the paper profits will eventually be eaten up (when the price inevitably reverses and reaches the stop).
  2. As mentioned above, in most cases, the operation of Trailing Stop requires an enabled trading terminal with uninterrupted access to the Internet.

In addition, when using a trailing stop, you should take into account the fact that it starts working only when the specified profit value is reached. Until this moment, the position remains without a loss limitation order. Therefore, I recommend first placing a Stop Loss order (can be at the same distance as the planned trailing stop), and only after that attaching it to the Trailing Stop position.

The nuances of using a trailing stop

Any directional price movement is cyclical. It has its phases of ups and downs. Another thing is that with an upward trend, the upswing phases last longer than the downturns, and with a downward trend, on the contrary, the size of the downturns prevails over the upturns.

In addition, any long-term trend is characterized by phenomena called “rollbacks”. That is, a short-term trend reversal in the opposite direction can always occur, followed by a return to the original direction.

The picture above shows a fragment of a price chart with a clearly expressed long-term upward trend. As you can see, the price on the chart does not grow linearly. Instead, it fluctuates up and down. And sometimes you even get the impression that the trend is turning downward (price rollback occurs).

The mechanics of a trailing stop are quite simple and consist in dragging a stop order at a specified distance from the current price. If I may say so, then trailing does not care about the phases of declines, phases of rises, rollbacks and other nuances of price movement. That is, by holding a position in accordance with a long-term trend and entrusting the movement of the stop order to the trailing stop, you can fly out of it either at the counter phase of the trend or at its pullback.

So, in order not to fly out of the position at the next price pullback, you need to set a larger moving stop size. But this is fraught with large losses if the price actually reverses.

If you place stop orders at a relatively short distance, you can exit the position ahead of time and miss a large part of the ongoing price movement.

So what should we do in this case? Let's move on smoothly to the next chapter.

Initial data

To test the trailing stop, I made a simple bot for hourly charts:

Entry is made when the main line of the Stochastic indicator on the hourly chart crosses level 25 (from top to bottom for sales and from bottom to top for buys), and the main line of the Stochastic indicator on the daily chart is inclined towards the intended transaction. The exit is made according to a set of different rules (within 10 rules for different market situations). This EA does not have a trailing stop.

In order not to overload the article with tests, I took only the main currency pairs - USDCHF, GBPUSD, EURUSD, USDJPY, USDCAD, AUDUSD. Tests were carried out from 2000 to the present day. I will optimize and then select the best set of parameters in terms of profitability. The advisor has control over the closing of bars and performs all operations at the beginning of a new candle, in this case H1.

This allows you to get rid of various accidents such as unstable server operation, spread widening, slippage, and also makes it possible to carry out testing with accuracy “At opening prices”. When using higher timeframes and applying control over bar openings, the difference between such testing and testing “By ticks” on real tick quotes is only in the machine hours spent on testing.

Then I took the library of trailing stop functions from our forum and attached it to the advisor. We will be testing most of these trailing stops. Go!

Alternative to a trailing stop

In many cases, it is better to transfer stop orders manually rather than trust this task to automation. This approach, although not so convenient in a purely utilitarian sense, allows you to approach the issue of position management more flexibly.

Let's look at an example of the same price chart again:

In this case, manual transfer of protective stops is carried out according to the following algorithm:

  1. In an uptrend, a stop loss is set at each newly formed price minimum (in a downtrend - at the next maximum);
  2. The stop is moved only after the price breaks its next maximum (in a downward trend, the minimum);
  3. In the event that the stop is triggered and the position is closed, we leave a chance in case of a possible continuation of the trend (if this closure occurred not as a result of a trend reversal, but as a result of its rollback). To do this, place a pending order (to open a position) at the level of the previous maximum (for a downward trend - at the level of the previous minimum).

Opening and closing a trade in parts (scaling)

When planning a trade, a trader determines how much money he will invest in it. The scaling method involves opening an order not for the entire amount, but for a part of it. If the market moves in the planned direction, the trader gradually buys more shares. You can close transactions in the same way. When the price reaches a certain level, they sell part of the asset, thus fixing a profit. The other part remains in the deal. In a situation of price reversal, losses will be minimal.

Advanced scaling

The advanced scaling technique is the gradual opening of positions during a period when the price is moving in an undesirable direction. Thanks to this tactic, the best average price for entering the market is achieved. The method is suitable for experienced traders who can correctly analyze the market.

Kelly criterion

This tool allows you to determine how much of your deposit a trader can use for a new trade. It is based on an analysis of past similar operations.

For calculation use:

  1. Probability of transaction success (in percentage).
  2. The ratio of profitable and unprofitable trades in the past.

Experienced experts do not recommend using the Kelly criterion as the only indicator.

Rating
( 1 rating, average 4 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]