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 Integrated Development Environment, where traders and developers can gain access to the entire application development cycle.

Who Uses Algorithmic Trading

Algorithmic trading is used by different types of market participants to reduce their risk or to boost their trading efficiency. Institutional investors, such as mutual funds and insurance companies, use algorithmic trading to execute large orders in the market so that they do not impact the prices of the underlying assets. These buy-side companies usually place positions in the market for the medium to long term. There are also short-term traders, such as HFTs (high-frequency traders) and scalpers, who utilise algorithmic trading so as to take advantage of quick execution of orders in the market. This has the trickle-down effect of benefitting market makers, such as brokerage firms, who are able to guarantee enough liquidity for sellers in the market.  Algorithmic trading is also used by systematic traders who wish to trade by fixed entry and exit rules in the market. The efficiency of algorithmic trading suits market participants, such as hedge funds and trend followers, who wish to have a defined system of rules executed automatically in the market.

Advantages and Disadvantages of Algorithmic Trading

In addition to the practical advantages of optimising speed and efficiency of order entry, algorithmic trading helps to eliminate human emotions in trading activity. Trade entry and exits are conducted with pure objectivity, with there being no chance of subjective human emotions interfering with the logic or rationale of any appropriate strategy. Algorithmic trading also helps to preserve discipline and maintain consistent focus even in volatile markets or unfavourable conditions. A laid down trading plan should be followed to the letter, and trading strategies are applied at their optimal best for maximum performance. There is no risk of human error, and the integrity of a trading plan is upheld. Algorithmic trading also helps traders to perform objective backtesting and optimisation of their strategies. Backtesting allows traders to determine the viability of any trade idea and apply specific rules to a huge load of historical data to assess how a strategy performs under different scenarios. A strategy can then be optimised to be used in the appropriate market conditions based on historical lessons learned from the market.

Algorithmic trading also has its downsides. For traders, there is the danger of over-optimising a strategy. After a series of backtesting, traders can be tempted to constantly tweak strategies and end up creating strategies that cannot deliver desired results when deployed in the live market. Additionally, like computer code, algorithmic trading strategies are vulnerable to technical failures or other connection blips that may lead to missed opportunities. For the broader market, the execution speed of algorithmic trading can lead to market imbalances, such as the 2010 flash crash, which lasted 36 minutes and saw stocks lose almost 10% in that short span of time. Furthermore, algorithmic trading can also impact liquidity and eliminate the potential of traders profiting from tiny price changes in the market.

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 market. The 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 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. For security purposes, all payments made on the market are withheld, and will only be released to the seller when the customer expresses satisfaction.

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, it is not necessary because of multiple aided features on the platform. 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.

MetaEditor

When developing custom trading applications on MT5, like its predecessor MetaTrader 4, users use the MetaEditor, a major component of the Integrated Development Environment. MetaEditor allows for the creation, editing, compiling and debugging of the source code.

Here are the important elements of MetaEditor:

  • 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.

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.

Common Algorithmic Trading Strategies

Here are some of the most common algorithmic trading strategies:

  • Trend following strategies. These are strategies designed to ensure that only trades in tandem with the dominant trend are executed in the market. They are based on technical strategies, such as moving averages and channel breakouts.
  • Arbitrage opportunities. Arbitrage opportunities occur when there is a mispricing of similar assets in different markets or exchanges. A strategy can then be applied to buy an asset from one market in order to sell it in another, or vice versa.
  • Index fund rebalancing. Index funds rebalance periodically to maintain the original specifications of the fund. When this occurs, some assets are sold so that the trader can earn profits.
  • Mean reversion. These strategies calculate the average prices of an asset over time. High and low prices are considered temporary and traded on the assumption that they will eventually revert to the average.
  • Time-weighted average price. These strategies break up large orders and execute them in the market at evenly divided periods to minimise the impact on underlying prices.
  • Volume weighted average price. These strategies execute smaller portions of a large order based on historical volume profiles of the underlying asset.

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 by way of you developing your own automated trading strategy or sourcing from the best programmers and professionals in the market, MT5 has provided the platform to experience the full benefits of algorithmic trading. These benefits include 24/7 objective trading and the 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.

     

Start practicing today.
Open an AvaTrade account and experience what Algorithmic Trading is!