$ £ ¥
¥ £ $

Fractals Trailing Stop MT4/MT5 Expert Advisor

As you may already know, fractals can be a very useful indicator. Below you can download a free expert advisor for MetaTrader 4 that uses fractals to trail the stop-loss level of an order.


What is a trailing stop?

In case you are new to the concept of trailing stop: trailing stop is the practice of moving the stop-loss level closer to the current price when the price moves in your favor.

Trailing the stop-loss allows traders to limit their losses and safeguard their profits. It is a very popular practice.

As you may have read in books and forums, one of the first rules in Forex is Cut your losses short and let your profits run.


How does fractals indicator work?

In short, fractals are represented with arrows and highlight points where the price stops and reverses.

Fractals Indicator Example
Fractals Indicator Example

The presented MT4 expert advisor uses call the MQL4 function iFractals() to retrieve the value of fractals.


Trailing Stop Following Fractals

About MT4 Fractals Trailing Stop EA
About MT4 Fractals Trailing Stop EA

The expert advisor moves the stop-loss of the selected orders by assigning the value of the most recent fractal.


MT4 Fractals Trailing Stop

Trailing Stop is a very popular practice in the Trading Environment. With MT4 Fractals Trailing Stop EA, you can have your orders' stop-losses assigned to a recent Bill Williams Fractals indicator's values automatically.

MT4 Fractals Trailing Stop EA is an expert advisor for MetaTrader 4 platform that can manage your stop-loss levels of your orders.

In particular, this expert advisor can use the recent fractals reading to set the stop-loss for your positions.

Recent fractals outputs can be used as important levels of support or resistance and can act as good values for stop-loss.

Trailing the stop-loss to a recent fractal can be a viable strategy in several situations.

How Does MT4 Fractals Trailing Stop EA Work?

Parameters

MT4 Trailing Stop Fractals EA Input Parameters
Trailing Stop Fractals Parameters

This expert advisor supports the following input parameters to be configured by the trader:

  • Bars To Scan — how many bars to scan back to search for a fractal arrow.
  • Fractal Number to Use — which fractal to use — first, second, third, and so on.
  • Apply To Current Symbol Only — if false, the trailing stop will be applied to trades on all symbols using the respective Fractals value. However, the timeframe for Fractals calculation will be used from the current chart.
  • Apply To — select which types of orders to apply a trailing stop to.
  • Filter By Magic Number — true or false depending on whether you want to modify only the orders with a specific magic number.
  • Magic Number — specify the magic number in case the above is true.
  • Filter By Comment — true or false depending on whether you want to modify only the orders with a specific comment.
  • Comment — specify the comment if the above is true.
  • Enable Trailing Stop — if true, the EA is active and is trailing stop-losses.
  • Enable Notifications feature — if true, the EA will send notifications upon triggering.
  • Send Alert Notification — if true, the EA will issue native on-screen alerts.
  • Send Notification to Mobile — if true, the EA will send push-notifications to your mobile device.
  • Send Notification via Email — if true, the EA will send emails when it updates a stop-loss.
  • Show Graphical Panel — if true, a graphical panel will appear on the chart to control the expert advisor.
 

Warning! For the email and mobile notifications to work, you have to configure them in your platform beforehand. Native on-screen alerts do not require additional configuration.

Rules

The expert advisor is configured to work according to the following rules:

  • For Buy orders, it uses the most recent lower fractal.
  • For Sell orders, it uses the most recent upper fractal.

Remember that it is supposed to move the stop-loss level solely in the direction of the order, and never to increase the SL distance. This is because of fundamental risk management rules.

Example

We can see some ideal examples of this expert advisor in work below. The trailing stop moves the stop-loss level when it detects a new fractal and meets the conditions.

Example of Fractal TSL Following for a Sell Trade
Example of Fractal TSL Following for a Sell Trade
Sell and Buy Trades Profit from Fractals Trailing Stop EA
Sell and Buy Trades Profit from Fractals Trailing Stop EA
MT4 Order Modification History for Fractals Trailing Stop EA
MT4 Order Modification History for Fractals Trailing Stop EA

Why Is MT4 Fractal Trailing Stop EA Useful?

Risk management is one of the most important aspect of Forex trading. Using a stop-loss will protect you from margin calls and big losses.

In many cases, it is useful to have a trailing stop, which is a "moving stop". A trailing stop is a stop-loss where the value is updated when the price moves in the trade's favor.

There are many types of trailing stop — it can be a fixed step change or it can follow some indicator.

In the case of MT4 Fractals Trailing Stop Expert Advisor, the stop-loss follows the value of the most recent fractals indicator values.

There are several advantages of using MT4 Fractals Trailing Stop EA:

  1. Filtering options to select which trades to manage.
  2. A stop-loss is set automatically if there is none.
  3. The stop-loss follows the price when moving in the trade's favor.
  4. It doesn't require human interaction.
  5. Limit losses.
  6. Secure profits.
  7. Avoid margin calls.
  8. Notifications when the stop-loss is updated.

Download Trailing Stop EA for MT4

You can download the expert advisor using the link below and install it by following the presented instructions.

➥ Download MQLTA MT4 Fractals Trailing Stop

The installation is very easy to perform; the same is the use. Once you run the expert advisor, you can set all the necessary input parameters.

Make sure you enable Live Trading in the Common tab when attaching the EA and also in the platform's menu Tools→Options→Expert Advisors. Otherwise, it won't be able to modify orders.

How to Enable Live Trading for Expert Advisors in MT4?

MT4 Fractals Trailing Stop EA Installation

To install the EA, please follow the instructions below:

  1. Download the expert advisor archive file.
  2. Open the MetaTrader 4 data folder (via File→Open Data Folder).
  3. Open the MQL4 Folder.
  4. Copy all the folders from the archive directly to the MQL4 folder.
  5. Restart MetaTrader 4 or refresh the expert advisors list by right-clicking the Navigator subwindow of the platform and choosing Refresh.

Or you can read a more detailed instruction on how to perform the installation.


MT5 Fractals Trailing Stop

The MT5 version of this Fractals Trailing Stop EA is very similar that for MT4. It will trail stop-loss of all positions based on the filtering parameters. It will calculate Fractals values separately for each currency pair if you select it to work on all symbols.

Download Fractals Trailing Stop EA for MT5

You can download the MT5 version of this expert advisor using the link below and install it by following the presented instructions.

➥ Download MQLTA MT5 Fractals Trailing Stop

The installation is very easy to perform; the same is the use. Once you run the expert advisor, you can set all the necessary input parameters.

Make sure you enable Live Trading in the Common tab when attaching the EA and also in the platform's menu Tools→Options→Expert Advisors. Otherwise, it won't be able to modify orders.

MT5 Fractals Trailing Stop EA Installation

To install the EA in MetaTrader 5, please follow the instructions below:

  1. Download the expert advisor archive file.
  2. Open the MetaTrader 5 data folder (via File→Open Data Folder).
  3. Open the MQL5 Folder.
  4. Copy all the folders from the archive directly to the MQL5 folder.
  5. Restart MetaTrader 5 or refresh the expert advisors list by right-clicking the Navigator subwindow of the platform and choosing Refresh.

Or you can read a more detailed instruction on how to perform the installation.


Conclusion

One of the uses of the fractals indicator is detection of support and resistance levels. With this expert advisor, you can trail the stop-loss level to these prices. The free download also includes the open source code for the EA for you to study it and improve it according to your requirements.

 

You can open a trading account with any of the MT4 Forex brokers to freely use the presented here expert advisor for MetaTrader 4. If you want to use an MT5 version of the expert advisor presented here, you would need to open an account with a broker that offers MetaTrader 5.

Discussion

Do you have any suggestions or questions regarding this expert advisor? You can always discuss Fractals Trailing Stop with other FX traders and MQL programmers on the expert advisors forums.


Changelog

1.02 — 2023-05-25

  • Added an MT5 version of the expert advisor.
  • Added an option to trail stop-losses for all symbols.
  • Added panel scaling on hi-DPI screens.
  • Added an option to use a specific fractal number for the trailing stop-loss.
  • Fixed stop-loss calculation.
  • Fixed the calculation process to take into account the symbol's tick size (useful for CFDs).