Algorithmic Trading in MT5: EAs, Testing and Copy Trading

Module 14

Lessons in this module

5 lessons · 45 min

Start lesson 1
  1. 1Expert Advisors10 min

    A MetaTrader expert advisor (EA) is a program attached to a MetaTrader 5 chart that can analyse prices and place or manage trades by fixed rules. You install it in the MQL5/Experts folder, attach it to a chart and switch on Algo Trading. The EA applies its rules exactly, so you judge it by its rules, its inputs, its risk per trade and your own test.

  2. 2MT5 Strategy Tester10 min

    Backtesting is running a fixed set of trading rules over past price data to see how those rules would have behaved. In MetaTrader 5 you do it in the Strategy Tester, which reports profit factor, expected payoff and drawdown for the period you choose.

  3. 3Custom indicators in MT58 min

    MT5 indicators are price calculations MetaTrader 5 draws on a chart; some ship built in, and custom ones come from the MQL5 Market, Code Base or your own code. Market and Code Base downloads install themselves, while any other file goes in the MQL5 Indicators folder of the data folder.

  4. 4Forex VPS hosting8 min

    A forex VPS is a remote computer that runs your trading platform around the clock, so Expert Advisors and trailing stops keep working when your own computer is off. It earns its place when something on your account, such as an EA, a trailing stop or a signal subscription, must keep running without you.

  5. 5Copy trading9 min

    Copy trading means another trader’s positions are opened and closed on your own account automatically, scaled to your account size. Every copied trade, win or loss, lands on your account, so the provider and copy settings you choose are the decisions that matter.

About this module

Algorithmic trading is using a computer program that follows written rules to analyse prices and place, manage or close trades, such as an Expert Advisor (EA) running in MetaTrader 5. A program applies its rules exactly, every time and at any hour, so its results come down to how good the rules are and how well you tested them.

A chart window, a gear and a server rack with a clock face linked by arrows, showing a program that trades on a schedule
Algorithmic trading is a program that follows written rules for you, so the rules must be tested first.

This module is about how algorithms are built, tested and run. You learn what Expert Advisors are and how to evaluate one before it trades, how to backtest in the MT5 Strategy Tester and avoid overfitting, how to install and check custom indicators, when a virtual private server (VPS) earns its place, and how to choose a copy trading provider with a practical checklist. For a general definition of automated trading, see the KCM Trade article what is automated trading.

You should know the MT5 tools from Module 9, MT5 Power User and have written your own trading rules first, because an algorithm is only a set of rules a computer can follow.

How does algorithmic trading work?

Algorithmic trading works by turning trading rules into code: the program reads each new price, checks its entry and exit conditions, and sends, changes or closes orders when they are met. In MetaTrader 5 these programs are Expert Advisors, written in the MQL5 language and run on a chart.

A worked example: the rule is to buy EURUSD on the hourly chart when the 20-period moving average crosses above the 50-period, with a 30-pip stop, a 60-pip target and 1% risk. On a $5,000 account, 1% is $50, and $50 over 30 pips is $1.67 a pip, so the program rounds down to 0.16 lot ($1.60 a pip, a $48 risk). It repeats that sum on every signal, without skipping one.

What do you need to start algorithmic trading?

To start algorithmic trading you need written rules, a platform that runs code such as MetaTrader 5, historical data to test on, and a way to keep the program running, such as a VPS. You do not have to write code yourself: many traders start by testing an existing Expert Advisor.

How do you test an algorithmic trading strategy?

Test an algorithmic trading strategy in the MetaTrader 5 Strategy Tester: backtest it on years of history, check it on a later period it was not tuned on, then run it on a demo account before it trades live. Overfitting, tuning settings until the past looks perfect, is the main trap.

The tester's forward option holds back part of the period for that check. The MT5 Strategy Tester lesson walks through the settings, and the Expert Advisors lesson lists what to look for in a report before an EA trades your money.

What do traders ask about algorithmic trading?

Traders ask four things first about algorithmic trading: what algo trading is in simple terms, whether they need to code, whether it is profitable and how it differs from copy trading. The answers below each stand alone, with links to the lessons that cover them.

What is algo trading in simple terms?

Algo trading is short for algorithmic trading: a computer program follows fixed rules to open, manage and close trades. It does exactly what the rules say, at any hour, so the quality of the rules decides the results.

Do you need to know how to code for algorithmic trading?

No. You can run and test an existing Expert Advisor without writing code. Learning some MQL5 helps you change the rules yourself, and MetaEditor, built into MetaTrader 5, is where that code is written.

Is algorithmic trading profitable?

It can be, when the rules have a real edge that holds up in testing on data they were not tuned on. A program does not create an edge; it executes one consistently, so test results and drawdown matter more than any single month.

How is copy trading different from algorithmic trading?

In algorithmic trading your account follows a program's rules. In copy trading it follows another trader's positions, so the checks focus on that provider's record, drawdown and risk per trade.

Practise what you learned

Open an account to use MetaTrader 5. Start on a demo account before risking real money.

Open Account