Skip to content

Expert Advisors in Trading – MetaTrader EA Guide

justin freeman
Justin Freeman trader
Updated 6 Nov 2024

With computer programs being accountable for the majority of trading activity in many major financial markets, it’s no surprise that retail investors are taking up the option to trade using algorithms. The benefits of switching to program-based trading can be particularly appealing, and some brokers have made taking the first step in the process a lot easier.


YOUR CAPITAL IS AT RISK


How Does Expert Advisors on MetaTrader Work?

That’s where the Expert Advisors service provided by MetaTrader comes in. It allows traders with accounts at brokers that support the MetaTrader 4 (MT4) and MetaTrader 5 (MT5) platforms to develop their own programs, or bolt on those that have been developed by other traders. Trading decisions can then be fully automated. This is how Expert Advisors works.

Background History of MetaTrader Expert Advisors

Whether you’re taking on the ideas of another human, or a model built by a third-party computer programmer, it’s important to carry out due diligence to check that your source is legitimate. In this respect, the Expert Advisors service scores highly.

The MT4 platform was first introduced in 2005, and MT5 came to the market in 2009. Between them, the two platforms are the most popular forex trading platforms in the world. With millions of traders using them daily, they have been tested thoroughly and now represent a reliable and robust option for traders.

Features designed to allow traders to incorporate algorithm-based trading have been present from day one, so the Expert Advisors facility has also been extensively tested. Aligning its platforms with the market-wide move to program-based trading was a smart move by MetaQuotes Software, the owner of MT4 and MT5.

In 2006, algo trading accounted for only about 25% of forex market volume, but by 2016, more than 80% of currency orders were executed using trading algorithms. The story in the equity markets was similar. In 2003, only 15% of US equity market volume was algo-based, with that number surging to 70% by 2010.

Other markets can also be traded using Expert Advisors, with stock indices and commodities among the asset groups that can be traded using algorithmic models. As a result of this user-friendly functionality, someone with an MT4 account with the broker IG, for example, can use Expert Advisors to trade more than 80 markets.

MetaTrader Expert Advisors – Signals and Execution

With the reputation and credibility of MetaTrader’s Expert Advisors verified, it’s worth considering how to get the most out of the service.

The first decision to make is whether you want to use Expert Advisors to create signals, which you then consider, and trade manually, or set up your account so that EA executes the trade automatically on your behalf.

If you select the fully automated option, then both trade entry and exit parameters can be included in the program, along with stop-loss and take-profit orders. You benefit from the full functionality of the MT4/MT5 trading platforms, but don’t have to be watching a screen 24/7.

Expert Advisors – Design Your Own or Use One Created by Others?

Once you’ve established whether you’re going for semi or fully automated trading, the next question is whether to trade using models built using your own code, or to download a ready-to-use model created by another programmer.

Setting up your own programs can be time-consuming but also rewarding. There are plenty of guides to help you learn how to get the most out of the MetaQuotes Language (MQL), or you can use ‘wizards’ that speed up the process.

An EA program can draw on data from numerous different markets at the same time. If your model ultimately leads to making a trading decision in EURUSD, then it can still factor in data points from markets such as gold, stock indices or other currency pairs. When those signals align, your Eurodollar trade is booked.

Thanks to the MQL community being so large, it is also possible to download and apply EA models created by other traders. Some of these are free, while others charge a fee. Whichever option you take, it’s worth noting that new models can be run in demo account mode so that you can test its performance before trading real cash.

Back testing, the process of running a model through a simulated market environment, is also possible and will allow you to establish what the trading performance would have looked like during previous periods of time. This can be time-consuming, and variables such as slippage might not be fully factored into the hypothetical performance results. Despite these challenges, it is a valuable part of the process and is one worth investing time in.

What Are Some of the Metrics Used in Expert Advisors?

Expert Advisors works by applying a series of yes/no rules to market situations. An example of a simple one would be using mean reversion techniques in GBPUSD. It could be applied to any timeframe supported by the MetaTrader platforms, with scalpers focusing on one-minute timeframes and trend models using daily, weekly or monthly price charts.

The below chart illustrates moments when on an hourly price chart price moved away from the SMA by 2 standard deviations. The move to the upside that clipped the upper Bollinger Band triggered a sell signal, and the one to the downside a buy signal.

gbpusd hourly price chart bollinger bands 2 sd
GBPUSD – Hourly Price Chart – Bollinger Bands 2 SD | Source: IG

Creating an EA that trades using Bollinger Band parameters would result in the model flagging up whenever those signals were triggered. If you opt for fully automated trading, then the model would execute a trade on your behalf. The parameters used to close out the trade might be when price returns to the same level as the 20 SMA.

The default settings of the MT4 and MT5 platforms include more than 30 indicators and oscillators. If you have a particular metric that isn’t on that list, there is the option to download it and include it in your analysis. This means that you can build a suite of parameters designed to suit your trading style.

Pros of Using Expert Advisors

We’ve already mentioned the fact that MetaTrader and Expert Advisors have been operating for decades and can be trusted from an operational perspective. Another benefit of that backstory is the online community that grew up around EAs over many years. It is a great place to go to share thoughts, ask a question, or crowdsource ideas.

Once you’ve come up with the idea for a strategy, it takes just the click of a button to set up trading to be automated. This means that you’ll catch more trading opportunities because your account will book trades while you’re otherwise engaged. It also means that you can focus on your day job or lifestyle commitments while still getting exposure to the financial markets.

If you decide to buy and download an EA from another programmer, there are some that are already being used by countless other traders. Don’t forget that this route means that you’re still relying on a third party to make the right calls on your cash, but there is some comfort that comes from the track records and review histories of some of the EAs that are available.

One of the biggest benefits of Expert Advisors is that it takes the emotion out of trading. A key element of successful trading is to have a clear strategy and be disciplined when implementing it. Creating a model is an ideal way to implement that approach, though, of course, some monitoring would be recommended.

It’s also worth remembering that the Expert Advisors service is very flexible. It can be applied to a wide range of markets, and there are models to suit your natural trading style. Whether you naturally lean to scalping forex or running a long-term equity momentum strategy, Expert Advisors can help you set up to pursue your targets using algorithms and automated trading.

Cons of Using Expert Advisors

The functionality of Expert Advisors is an ideal fit for many and can result in improved trading returns, but there are still potential pitfalls to be aware of.

One common fear experienced by all systematic traders is that a ‘paradigm shift’ occurs. This applies to models run at huge hedge funds as much as it does traders using EA.

Trading with algos requires having faith in your model and being able to accommodate losing as well as winning trades. The approach relies on being confident that a strategy will be right ‘in the end’ thanks to all the back testing that was carried out. However, if there is a paradigm shift, you could end up booking losing trade after losing trade and blowing up your account before realising that the model is no longer effective.

Factors that could cause such a disturbance largely relate to fundamental analysis and news events. Computer models back tested over periods of relatively calm market conditions might become less effective when events such as wars, oil price shocks, and surprise political events such as the Brexit vote impact the market.

One of the common misconceptions surrounding algo-based trading is that the big quant funds that dominate the market trust the code so implicitly that they always run their models. The reality is that human intervention will sometimes take place, with fund managers deciding to turn off their models until ‘normal’ conditions return.

The mechanics of putting on a trade can also create challenges. Slippage is the term that describes the difference between the price that a trader tries to execute at and the price that they actually pay. With prices moving almost instantaneously, traders can’t get around the fact that they are dealing with a moving target, and short-term strategies in particular can fail due to models not being able to execute at the intended prices.

Using a virtual private server (VPS) can reduce the amount of slippage experienced. This approach involves placing your model on a server that is in close proximity to an exchange so that low latency results in more efficient trade execution.

VPS trading also gets around another problem associated with Expert Advisors: that it only works on computers that are switched on. If you’re trading from home, or your phone, and turn it off, then your EA model will stop trading.

How to Set Up Using Expert Advisors

Most of the work associated with setting up an Expert Advisor relates to the research and testing of models. The process of setting up to use EAs is by comparison very straightforward.

The first step is to sign up with a broker that offers trading using MT4 or MT5. Many of the best brokers in the market do this thanks to the popularity of the MetaTrader platforms and EA trading service.

Once you’ve signed up, simply follow the instructions to download the MT4 or MT5 platform. This can be done to desktop, or handheld devices, but EA is not currently compatible with the WebTrader format of the MetaTrader platforms.

You’re then ready to create your own EAs or download those of others.

Final Thoughts

Most of the pros and cons of using systematic trading models extend to all quant funds, not just MetaTrader Expert Advisors. The appeal of the approach is demonstrated by the fact that algos account for so much of market activity. This demonstrates that some programmers are getting it right and making consistent long-term returns.

The process of developing the skills needed to become part of that group is made easier by the user-friendly functionality of Expert Advisors. It’s possible to pursue the subject as far as you like, and if the urge takes you, move on to higher-level programming. Starting out using EAs is a great first step, as it can involve you developing your own code or learning from the way that an imported one works.

Whichever route you take, back testing is a great place to start your research. It is time-consuming, and your model will be trading what happened, not what might happen in the future. However, it is a process that is worth committing to.

Running a model in demo account mode is the logical next step. This can give a clearer picture on whether it might be profitable but might not factor in slippage – which is of greater importance if you’re running a scalping strategy.

Building or buying a trading model is the first part of the process, and moving on to trusting it to trade real money is a big step to take. Of equal importance is the need to use a trusted broker. This list of the best MetaTrader brokers includes firms that are regulated and offer competitive pricing to help your trading get off to the best possible start.

People Who Read This Also Viewed:

justin freeman
Justin is an active trader with more than 20-years of industry experience. He has worked at big banks and hedge funds including Citigroup, D. E. Shaw and Millennium Capital Management.