Algorithmic trading: how to test and correctly use Forex expert advisors

Share this:
Editorial Note: While we adhere to strict Editorial Integrity, this post may contain references to products from our partners. Here's an explanation for How We Make Money. None of the data and information on this webpage constitutes investment advice according to our Disclaimer.

Algorithmic trading allows you to automate manual Forex trading strategies. On the one hand, it provides an opportunity to earn even more, or save time. On the other hand, if an expert advisor is not properly set up and monitored, you may also quickly lose your deposit. If all EAs brought profit and all traders earned money in just one click, the market would have ceased to exist. Therefore, regardless of whether you have a manual trading strategy or you are using an EA, the positive result depends exclusively on your experience and on how well you can use the tools at hand.

In this review you will learn about the following notions:

What an expert advisor is and how it can help your trade. Where to find a working EA.

The rules for using expert advisors.

The rules for testing EAs and evaluating their effectiveness.

This article will be quite useful for those who believe that algorithmic trading is ‘simple’.

Start trading Forex now with eToro!
eToro is a multi-asset platform which offers both investing in stocks and cryptoassets, as well as trading CFDs.

What is an expert advisor?

An expert advisor is a program, a software application written in the language of the platform that automatically follows the algorithm built into its code to execute specific tasks. The simplest expert advisors execute actions that are standard for manual strategies: opening and closing positions when the signals coincide with those in the code, setting pending orders, calculating the volume of a position, etc. Professional algorithmic trading is gradually developing as well. Lately, neural networks and artificial intelligence based on machine programming have become quite popular. Such robots are able to independently sort through all possible combinations according to the input data and self-learn, optimizing the result.

Benefits of expert advisors

Expert Advisor Pros:

  • Automation. EAs save time, and they look for signals, automatically open and close positions, set pending orders and stops, etc. instead of you.

  • High precision of signal recognition. In the situation, when signal formation seems conflicting (different readings of indicators, blurred formation of patterns), the EA makes an unambiguous decision.

  • High speed. EAs instantly identify signals and open positions. For this reason, HFT robots are particularly popular, as they can open dozens of positions in a matter of a second (high-frequency trading).

  • Ruling out the influence of emotions on trading. EAs rule out the situation, when you have a desire to break the rules of risk management or open a position based on emotions (euphoria, fatigue or despair).

An expert advisor is an auxiliary tool. It cannot fully replace a person, but can make a number of tasks, including decision making, much easier. Find out how to run multiple Expert Advisors in the TU article.

Drawbacks of expert advisors

Expert Advisor Cons:

  • Ignoring fundamental factors. In manual trading, traders analyze the news background that can seriously change the market sentiment. The majority of expert advisors operate on a given algorithm and therefore don’t take news into account. Recently, complex automated systems have started to appear that take into account the changes in the fundamental statistics, but they are mostly used on professional “industrial” level.

  • Necessity of control. Despite that EAs automate the trading process, you need to monitor them continuously. There are situations where it is best to manually close a position early.

  • Necessity of continuous optimization. The market situation tends to change, and if the results start to slide, you need to find the best settings once again.

Also, it is desirable to have a VPS service when using robots. The platform is located on the server and not on the user’s PC. This way the robot can continue operating even when the connection fails. That, however, means additional expenses for renting server capacities.

Where do I find a working Forex EA?

1

Online. Enter a corresponding word in the search bar and you will get dozens of websites with free expert advisors. Often, various investment websites and analytical portals feature their reviews. The only question is which of them really work and how much time you will spend on finding a profitable expert advisor.

2

Purchase. There are companies specializing in trading software development. They can provide robot testing results, free updates and assistance in optimization. They cannot guarantee a positive result, but it is still better than sifting through all the existing EAs online. It is also possible to buy EAs from private individuals, but at a high risk of a scam.

3

Ordering to write a code based on a ready-made strategy. If you have a profitable manual strategy, you can order a code to be written based on it in the language of the platform you are using. For example, you can order a code for MT4 in the freelance section on the MQL5 website.

4

Develop one on your own. There are standalone programs as well as apps for trading platforms that allow you to automatically generate the code based on the set conditions of a trading strategy. It is difficult to call them ideal, because the set of basic features is limited, but they are good for building simple robots. Examples of constructors include System Creator, Visual Strategy Builder.

How to Write a Trading Robot

How do I use Forex expert advisors?

An expert advisor is a file with a written code. This file needs to be copied to the corresponding directory of the platform, provided that it supports adding custom software.

Stage 1: Testing. This is the most important, most complex and labor-intensive stage. It involves running the EA on previous timeframes on several assets. The expert advisor is run on various parameters and lasts until the best result is achieved with the confirmed profitability of the advisor.

Stage 2: Analysis. Backtest statistics is the basis for the analysis. Backtest is a report with statistics and an equity curve.

Example of backtesting Ilan 1.6 Dynamic expert advisor

Example of backtesting Ilan 1.6 Dynamic expert advisor

Example of backtesting Ilan 1.6 Dynamic expert advisor

Example of backtesting Ilan 1.6 Dynamic expert advisor

Deciphering each line of the backtest is a top for a separate article, but each indicator is of fundamental importance, showing the effectiveness of the expert advisor and the level of risk.

Best Forex EA - Free Expert Advisor for MT4

Stage 3: Launch. It’s all simple here. The testing results show the strengths and the weaknesses of the expert advisor. For example, they show that the EA is effective only at night and only for the USD/JPY pair, so you run it at night. You can do this either manually or download a utility that automatically starts and disables the EA at a specified time.

The main rule for using EAs is control over the deviation of the real statistics from testing results. If the deviations are critical on a number of indicators, even if there is profit, it is better to stop it and send for optimization. Optimization means changing the settings and other parameters that improve the software effectiveness.

Testing expert advisors

Testing involves launching the EA to run using the history of quotes with different parameters and in different conditions. Using the brute-force method, time periods, assets, timeframes, EA settings that provide the best financial result at the optimal acceptable risk are determined.

Rules for testing expert advisors:

  • Number of trades. At least 150-200 trades are considered optimal, but it also depends on the period. If we are talking about a scalping EA that opens 20-30 or more positions per day, we base our testing on the time period – you run the expert advisor on a period of no less than 1 month. If we are talking about day trading with opening of 1-2 trades per day, a period of 1 year is enough. For medium and long-term strategies, the recommended period is at least 3-5 years with the number of traders at least 300. This parameter can be chosen individually: gradually increase the testing period until the results become consistently the same.

  • Nature of equity. The deposit curve must have a stable upward look. Deep drawdowns point to instability of the expert advisor. Frequent drawdowns are acceptable, but there should be a high recovery factor, which is a parameter that shows how quickly the EA can recover a loss after a drawdown.

  • Quote quality. It doesn't matter where you take the quotes from, but it is important that there are no gaps or abnormal prices. Testing EAs while using incorrect quotes will quite expectedly give incorrect results. Often, brokers offer quotes, but they can also be downloaded from third-party sources. You can check the quality of quotes by uploading them to Excel and comparing several bases with each other.

  • System stability check. According to the wave theory, the market goes through the phases of rise, fall and reversals at the extremes. An EA must show stable results in each of the phases. In other words, EA settings are selected both during testing on the entire time period and on certain phases of it. Stability is also checked in the morning, afternoon, etc. These actions allow you to determine the areas where the EA shows the best results. The third type of stability check is testing on different timeframes.

The more diversified the EA, the more universal it is, the more resistant it is to the changes in the market.

Evaluating the effectiveness of EAs

Effectiveness of an expert advisor is primarily evaluated by the profit it brought over a specific period of time. However, profit does not allow to evaluate the level of risk, and therefore backtest quality is the second main criterion.

Criteria for evaluating the EA effectiveness:

  • Nature of equity at the last stage. The transition of equity to the horizontal or rounding down on the last trades indicates that the EA is starting to have problems. Running it on a real account is not recommended.

  • Key indicators of the backtest. Maximum number of continuous profitable and unprofitable positions, the highest profit and loss, maximum drawdown, recovery factor.

  • Absence of abnormal drawdowns in crisis areas. This means that the EA will not drain the deposit in case of a force majeure event.

Testing does not provide a 100% guarantee that the expert advisor will work the same way on a real account. The reasons include slippages, floating spread, and fundamental factors. These cannot be taken into account when testing the EA. However, if a Forex EA tester shows a loss even when previous data is used, the robot does not work.

Tips for optimizing algorithmic trading

Most tips are related to testing. Once an expert advisor passes the testing, the bigger part of the task has been fulfilled. Tips:

Practice multi-testing. Launch the EA for several Forex pairs in the same time period. A universal expert advisor should show comparatively the same statistical results. Deviations are allowed only if the assets that are being tested strongly differ in liquidity and volatility. Some trading platforms allow users to simultaneously test EAs on several assets. For example, MT4 allows only sequential testing, while MT5 – parallel.

Be careful when launching several EAs for one asset. Theoretically, it is allowed. Each EA has the MagicNumber parameter in its settings, which the EA uses to distinguish its trades from those of others. However, in practice, EAs may conflict with each other and work incorrectly. Also, if the EAs open positions simultaneously, it could violate the rules of risk management. This also applies to the EAs working for different assets in one account.

Check the performance of the EA in critical areas. For example, during the periods (years) of the global economy stagnation. If an EA is stable even at the times of force majeure events, it is a good EA.

Use the forward testing principle. This is how it works: the tested period is broken down into 2 parts at the 3:1 ratio. For example, a period of one year is broken down into January-September and October-December. The first period is the main one. The EA with the best parameters is run on the second period. If the results are the same, it means that the EA passed optimization.

The main criterion of optimization is that you like the results of the EA’s performance. Whether you set it up for aggressive trading or a conservative strategy is up to you.

Best Brokers 2024

1
9.4/10
Go to broker
eToro is a multi-asset investment platform. The value of your investments may go up or down. Your capital is at risk. Don’t invest unless you’re prepared to lose all the money you invest.
Minimum deposit:
$50
Bonus for deposit:
0%
Regulation:
CySEC, FCA, ASIC
2
9.2/10
Go to broker
Your capital is at risk.
Minimum deposit:
No minimum
Bonus for deposit:
0%
Regulation:
FSC (BVI), ASIC, IIROC, FCA, CFTC, NFA

Summary

Brief conclusions:

Expert Advisor is a program (software) that allows you to automate the actions of searching for signals and managing trades. The robot operates based on the code. Its performance results largely depend on the chosen settings.

Testing the EA using the quote history is a mandatory step. The task of the testing is to determine the best areas, assets, settings for the EA.

Backtest is the key document that shows the effectiveness of the expert advisor.

There are paid and free EAs. The effectiveness of both depends exclusively only on your ability to work with them. Paid EAs or EAs written based on your trading strategy have a higher rate of success.

EA is a tool that can prove to be instrumental for earning a profit in the hands of an experienced or smart trader. Attempting to run an EA without understanding how it works or having its trading statistics at your disposal is a direct path to losing your deposit.

FAQs

How do I use EAs correctly?

An Expert Advisor is run on the real account only after testing and analysis of the backtest parameters. Testing is done on the built-in tester of the platform or independent software. The objective of the testing is to find assets and select robot settings to achieve the best results. If the actual results do not match the testing results, the robot needs to be re-optimized.

What are the main parameters for evaluating the effectiveness of EAs?

The main parameters include profitability, performance stability for all assets and at any trading time, absence of deep drawdowns, mathematical expectation, number of profitable and unprofitable trades in a series, profit to loss ratio. There are testers with advanced analysis capabilities that are similar to MyFxBook monitoring.

Which is better: a manual strategy or an EA?

Despite automation of trading, an expert advisor is only a program working based on a set algorithm. In case of doubt, a person can use other instruments to determine whether the signal is true or false, while an EA opens a position when the conditions specified in the settings and the code match, without taking additional factors into account. Therefore, the best way is to combine both, i.e. to control the work of the EA and interfere manually from time to time.

Is there sense in paid EAs?

There is sense in paying for an EA, if you know why you need it and who you are buying it from. Unfortunately, there are frequent cases, when a person subtly changes the code of a free EA and passes it as his/her own, paid one. Therefore, do not rush to spend your money. There are many free EAs that can be set up for a specific market situation or, at the very least, order a change in the code, which will be cheaper. Practice shows that the majority of sellers bear no liability for the performance of their software. Buy EAs only from large software developers and be skeptical about private sellers.

Team that worked on the article

Oleg Tkachenko
Author and expert at Traders Union

Oleg Tkachenko is an economic analyst and risk manager having more than 14 years of experience in working with systemically important banks, investment companies, and analytical platforms. He has been a Traders Union analyst since 2018. His primary specialties are analysis and prediction of price tendencies in the Forex, stock, commodity, and cryptocurrency markets, as well as the development of trading strategies and individual risk management systems. He also analyzes nonstandard investing markets and studies trading psychology.

Dr. BJ Johnson
Dr. BJ Johnson
Developmental English Editor

Dr. BJ Johnson is a PhD in English Language and an editor with over 15 years of experience. He earned his degree in English Language in the U.S and the UK. In 2020, Dr. Johnson joined the Traders Union team. Since then, he has created over 100 exclusive articles and edited over 300 articles of other authors.

The topics he covers include trading signals, cryptocurrencies, Forex brokers, stock brokers, expert advisors, binary options. He has also worked on the ratings of brokers and many other materials.

Dr. BJ Johnson’s motto: It always seems impossible until it’s done. You can do it.

Mirjan Hipolito
Cryptocurrency and stock expert

Mirjan Hipolito is a journalist and news editor at Traders Union. She is an expert crypto writer with five years of experience in the financial markets. Her specialties are daily market news, price predictions, and Initial Coin Offerings (ICO). Mirjan is a cryptocurrency and stock trader. This deep understanding of the finance sector allows her to create informative and engaging content that helps readers easily navigate the complexities of the crypto world.