Trailing Stop Expert Advisor For MT4

Trailing Stop Expert Advisor For MT4



PLEASE NOTE: This expert advisor was publicly available for free usage on other websites and is not programmed by us. We explain the functionality and possible improvements of the EA. Furthermore, we are convinced that fully automatic Expert Advisors will fail in the long run. On the other hand, our semi-automatic approach with detecting the best setups and then activating our Expert Advisors (e.g. V-Power EA, EdgeZone EA) produced many successful traders and some of them even got prop traders at prop trading firms. Therefore, we added a similar semi-automatic trading feature (to allow only buy or only sell trades) to the free Expert Advisors. You can download the modified version here and enjoy!


Table Of Contents:

  1. Trailing Stop Expert Advisor For MT4
  2. The Trailing Stop Expert Advisor For MT4 – Entry Criteria
  3. The Trailing Stop Expert Advisor For MT4 – Exit Criteria
  4. The Trailing Stop Expert Advisor For MT4 – Room for Improvement


The Trailing Stop Expert Advisor is a MetaTrader4 program that is used for trade management. As such, it is better classified as a trading utility than a trading system. As a trade management tool, the robot performs only one trading operation, that is, stop trailing. It does not open market or pending orders. Because of this, it is not possible to test this robot in the strategy tester because it will not open and close trades. The only way to test this robot is to apply it on a demo account, not to see if it makes money, but to determine if the algorithm works.

Being a trade management utility, the robot could not be converted into a custom indicator or a script. A script performs all its intended functions only once and then removes itself from the terminal. Therefore, it could not monitor the status of trades. Meanwhile, an indicator remains on the chart as long as the user does not manually remove it from there. However, it could not perform any trading operations such as order modification. Therefore, the user must be content to see this expert advisor taking full control of a chart where it is running in MetaTrader4 platform.

FREE Trailing Stop EA

Download the FREE Trailing Stop Expert Advisor for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!

The Trailing Stop Expert Advisor For MT4 – Entry Criteria

The Trailing Stop Expert Advisor is a very simple trading utility. Basically, the utility uses the start function only, although it contains the initialization and deinitialization functions. On every tick, it loops through the orders in the trade pool to find trades that can be trailed. The trailing stop operation is performed on the current symbol only, but the utility is applicable to any type of trading account, be it connected to a broker with four-digit or five-digit price quotes (or two-digit or three-digit price quotes for yen pairs).

The moment the expert advisor is dropped on a chart, it will display a large horizontal button in color yellow that contains the text “TrailingStop Expert is running!” The large button attempts to draw the attention of the user to it so that he is aware that this expert advisor is running on the active symbol. If the user wants to use this expert advisor on other symbols on the trading account, he must apply one instance to each symbol or chart.

The robot provides only three parameters in Inputs that the user can adjust at will. These parameters are explained in the following:

  • TrailingStop = 5 – This value, given in pips, means that the robot will start trailing the stop loss of a trade if the trade has gained at least five pips.

  • StopLoss = 0 – This parameter comes into play if its value is adjusted to a value other than zero.

  • size = 12 – This parameter pertains to the size (in pixels) of the text in the button object shown on the chart.

There are some conditions that must be satisfied before a market order can be trailed. The actual process of stop loss adjustment varies for buy and sell trades, but the concept is the same. First of the conditions for stop trailing is that the trade should have gained at least five pips as defined in expert settings.

When dealing with trade management, the price being used as reference for a buy trade is the bid price and ask price for a sell trade. For a buy trade, the bid price should be located above the entry price and the distance between them should be at least five pips. Next, to avoid repeatedly adjusting the stop loss of a buy trade when it is not necessary, the robot must establish that the stop loss is below the bid price minus five pips. If these conditions are satisfied, the stop loss of the buy trade will be adjusted. As a result, the stop loss of the trade will be placed five pips below the bid price.

For a sell trade, the mechanism for stop loss adjustment is different. First, the robot will determine if the ask price is below the open price. Then, it will measure the distance between the ask price and the open price. If the distance between them is at least five pips, the expert advisor will try to establish if the stop loss of the sell trade is greater than the ask price plus five pips. If this is the case, then the stop loss of the sell trade will be modified. The result is that the stop loss is placed five pips above the ask price.

The Trailing Stop Expert Advisor For MT4 – Exit Criteria

The Trailing Stop Expert Advisor does not have exit criteria since it does not open trades in the first place. What it does is manage orders opened manually by the trader on the current symbol. This way the trader does not need to manage trades by himself. He can simply set and forget his trades and then come back later to find out the results.

This trading utility cannot possibly manage trades opened by another expert advisor on other symbols as its scope is only the active symbol. However, it can possibly handle trades opened by another robot on the same symbol as long as that robot is attached to another chart. As an MT4 standard, it is not possible to put two or more expert advisors side by side on one chart.

The Trailing Stop Expert Advisor For MT4 – Room for Improvement

The Trailing Stop Expert Advisor can be improved further to make it a more useful trade management tool. One improvement is to put a comment on the chart to display the trail stop amount at which trades are trailed. The comment can also include information that the robot manages the trades on the current symbol only.

To make the expert advisor more versatile and flexible, the code can be modified so that the robot may cover all symbols, or at least the 28 major symbols, on the trading account. An expert coder can easily put this in place. In this way, the user does not need to use multiple instances of this expert advisor to make it applicable to other symbols. Only one instance of this expert advisor is attached on a chart, and it can see all trades on the trading account.

One cool feature that can be added to this utility is notification. Depending on the need of the user, notification may entail an alert, a message box, an email or a text notification. If this feature is put in place, the notification options can be put in Inputs, allowing the user to select one or more options to turn on as necessary. However, it is not necessary to send a notification every time stop loss adjustment is performed. The robot should be designed to send or display a notification when stop loss adjustment has started. This way the user is notified that an open trade has been secured, meaning it is already risk free and it has potential to generate more profits. Then if the user has time later, he can check exactly how much profit was realized by a trade.

The user can adjust the number of pips at which stop trailing is activated if he thinks five pips is too small. To do that, he needs to click on the smile icon of the expert advisor at the upper-right corner of the chart. If possible, the user should be given a chance to set a new trail stop value by directly typing it on a field on an interface in the main chart.


FREE Trailing Stop EA

Download the FREE Trailing Stop Expert Advisor for MT4.

To receive my email 100% sure: 
Put my email on your whitelist!


Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

About Me

I'm Mike Semlitsch the owner of My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group

Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.