Algorithmic Trading on MT5

use algorithmic trading at AvaTrade

What is Algorithmic Trading?

Algorithmic trading is simply turning a trade idea or model into a workable strategy through an algorithm. It basically involves the automation of trading analysis and operation, completely avoiding manual intervention. Algorithmic trading expands the possibilities of traders who speculate on financial assets online as it helps preserve discipline (no emotional interference), allows for back-testing, and achieves consistency in strategy application. Now, with the new and advanced MetaTrader 5 platform, traders can experience the simplicity and efficiency of algorithmic trading like never before. All components of algorithmic trading on MT5 are harmonised and available on the IDE (Integrated Development Environment), where traders and developers can gain access to the entire application development cycle.

Automated Trading Applications in MT5

Automated trading applications, like the Expert Advisors (EAs), in MT5 can be broadly classified into two categories: trading robots and indicators. Trading robots are created to perform trading operations in your account automatically, whereas indicators are designed to analyse price action or identify price patterns on a chart. You can incorporate indicators into trading robots to develop a complete automated trading system.  

Trading Robots and Indicators in MT5

MT5 is packed with numerous inbuilt and custom indicators, but you can access even more by browsing through the IDE market. The IDE market has practically the biggest collection of trading robots, indicators, scripts and other trading applications, all accessible to MT5 users. There are plenty of free applications, but others are available for rent or outright purchase. To purchase any trading application, visit its page and simply click ‘Buy’. There is also the Code Base, which is a free source code library for numerous FX trading applications that can be used on MT5.

As well, in the Freelance section, you can contract freelance MT5 programmers who can develop any type of trading application, to perform any specified function on the MT5 platform. After the process is done, the application will be downloaded to the appropriate folder, with its name added on the ‘Navigator’ that is accessible straight from your MT5 chart.

It is easier renting or buying a trading application, but it may be even better developing your own. While it may be beneficial to understand the native MT5 programming language, MQL5, it is not necessary because of multiple aided features on the platform. MQL5 is a high level, financial-oriented programming language modelled on C++ that helps traders develop MT5 trading applications and resources such as:

  • Expert Advisors (EAs)
    Trading robots that allow for the application of automated trading strategies on MT5.
  • Custom Indicators
    Custom mathematical tools that can be designed to perform specified analytical operations on the price of financial assets on MT5 price charts.
  • Scripts
    These are applications developed to perform certain functions on the MT5 application. You can, for instance, develop a script for closing pending orders on a price chart.
  • Libraries
    These are sets of custom functions intended to allow for the storage and easy distribution of commonly used applications on MT5.


When developing custom trading applications on MT5, like its predecessor MetaTrader4, users use the MetaEditor, a major component of the MQL5 IDE. MetaEditor allows for the creation, editing, compiling and debugging of the MQL5 source code.

Here are the important elements of MetaEditor:

  • MQL5 Wizard
    MetaEditor features the handy MQL5 Wizard which is designed to allow for the quick development of automated trading applications. You can easily develop a trading EA, even without any programming knowledge or skills. With the MQL5 Wizard, you only need to specify parameters, such as trading signal generation, money management or stop placement, and the tool will do the rest. The MQL5 Wizard also helps programmers to simplify their work by allowing for the development of quick base templates.
  • Source Code
    MetaEditor makes development work easier by recognising different source code language patterns and offering quick suggestions on how to utilise different functions. MetaEditor also highlights various elements of the program’s source code, thereby making navigation easier and consequently, accelerating the development process.
  • Debugging
    There is bound to be some errors in any development process. But MetaEditor features an in-built debugger that allows for quick troubleshooting by progressively monitoring all mutable values of an entire source code.
  • Profiling
    MetaEditor has dedicated tools that allow for performance optimisation of your trading applications. MetaEditor profilers can analyse the performance of your trading application, identify the slowest functions in your source code and improve upon them seamlessly.
  • MQL5 Community Resources
    You can access, directly from the MetaEditor, numerous MQL5 materials (tools and tutorials) and a huge code base of free automated trading solutions. As well, there is free online MQL5 storage for the safekeeping of development files as well as the ability to recover lost files. All this is accessible from any device using your MQL5 community login credentials.

Running Expert Advisors on MT5

EAs are easily accessible via the Navigator window on the AvaTrade MT5 platform. After locating the EA, double-click on it or drag-and-drop it onto the chart. When using the EA for the first time, the application window will pop up with two tabs: Common and Inputs. The ‘common’ tab contains information about the EA as well as the option to allow for the modification of signal settings and the auto-trading mode of the application. The ‘input’ tab contains more trading parameters, which allow you to control the activity of the EA. The parameters can include trading conditions such as lot sizes, take profit/stop loss levels, and even indicator values to watch.

After setting up the EA, there will be the possibility to toggle between auto and manual trading, straight from the toolbar. There are also plenty other direct platform settings that can be applied on EAs, such disabling automated trading when switching accounts or profiles, allowing DLL (dynamic link library), as well as allowing a WebRequest for specified URLs. You can also list your frequently used automated trading applications as ‘Favourites’ for quick access anytime you wish to trade with them.

Strategy Testing and Optimisation

Algorithmic trading is, obviously, very appealing as it allows a trading strategy to be utilised in its purest form; no fatigue, no emotional or psychological constraints and the ability to trade round the clock. But before you get started, it is important to ensure that the EA has proven to be successful based on historical prices, and it will make trading decisions based on set conditions. Thankfully, MT5 features a multi-currency and multi-threaded Strategy Tester that allows for thorough testing and optimisation of EAs before they are utilised in the live financial markets.

It is multi-currency because it supports parallel testing and optimisation on different financial assets; and multi-threaded because it allows for the use of more computer resources for faster and more efficient operations. The Strategy Tester allows for both backtesting and forward testing of both single and multiple financial assets. Optimisation is also possible with the aim of identifying the best possible parameter combinations of your preferred trading strategy. Using the Strategy Tester, you can run single or multiple sets with different parameters, and you will receive graphical representations of the results.

Final Word

MetaTrader 5 has clearly expanded the possibilities of algorithmic trading. Whether it is developing your own automated trading strategy or sourcing from the best programmers and professionals in the MQL5 market, MT5 has provided the platform to experience the full benefits of algorithmic trading that include 24/7 objective trading, elimination of human inefficiencies and consistency in strategy application.  AvaTrade offers our clients direct access to the powerful and intuitive MT5 trading platform.

Algorithmic Trading on MT5 FAQ

  • Does algorithmic trading really work?

    On a strictly technical basis the answer has to be yes. The Expert Advisors and robots created in MetaTrader 5 are nothing more than tools. That said, like any tool they are only as good as they’ve been created. And they are only good for the purpose they been created for. You wouldn’t try to use a hammer to turn screws and by the same token you can’t expect an Expert Advisor to do anything it wasn’t programmed to do. So long as it was programmed well, and is being used properly, algorithmic trading can be very successful. If it wasn’t there wouldn’t be so many algorithms being created.

  • Is algorithmic trading good or bad?

    It depends on your expectations. If you think you can simply pop in an algorithmic trading EA and MetaTrader 5 will make you truckloads of profits then it’s certainly a bad thing in your case. However, if you approach algorithmic trading realistically and with a sense of responsibility you really should be able to make some profits without taking on undue risks. Algorithmic trading is also good for removing some of the emotional and psychological aspects of trading. Some traders have issues with pulling the trigger or entering trades. An algorithmic trading EA will get past that issue.

  • Does algorithmic trading really mean automatic profits?

    Some people seem to think that you can take an Expert Advisor, turn it on, and just let it churn away, making winning trade after winning trade. The truth is actually quite far from this. Successful algorithmic traders are actually very engaged with their algorithms, making tweaks and changes as market conditions change, and even turning them off from time to time. An algorithm can perform significantly differently during news events and the like, wiping out profits made over weeks or months. Run from anyone who tells you their algorithmic trading strategy is automatic profits.