Main guide

Algorithmic trading with MetaTrader: the complete guide

A robot's whole journey, from the backtest to a live or funded account. Each step sums up the essentials. If you want to go deeper, it links to its own guide.

What algorithmic trading is

It's trading with rules written into a program that opens, manages or closes trades for you. In MetaTrader 5 or 4 these programs are called Expert Advisors (EAs). The robot doesn't get tired or hesitate, but it doesn't know whether the market has changed either: that part is still up to you.

Each EA tags its orders with its own number to recognize them. Understanding that detail saves a lot of confusion when you run several robots. We explain it in the magic number: what it is and why it's not enough.

Advantages and limits

  • Discipline: the program follows its rules without fear or euphoria.
  • Testable: you can measure an idea over years of data before putting money at risk.
  • Scale: several systems can watch different markets at once.

On the other hand, it has its weak spots.

  • A strategy can stop working without warning.
  • A technical failure, such as a VPS going down, halts trading.
  • It's easy to fool yourself with an overfitted backtest.

Automating doesn't remove the work: it shifts it from placing orders to monitoring systems.

What you need to get started

  • MetaTrader 5 or 4: free, offered by almost every broker.
  • A demo account: to test without money.
  • An EA: coded by you, generated with a tool or bought.
  • Quality historical data: the foundation of any simulation.
  • A machine that's always on: your PC or a VPS.

Where a robot comes from

Coding it

MetaTrader 5 uses the MQL5 language; version 4, MQL4. Writing your own EA gives you full control, at the cost of learning to code.

Generating it

Tools such as StrategyQuant X build strategies automatically from building blocks, then test them on historical data. They produce many candidates quickly. The challenge becomes filtering out the ones that are overfitted.

Buying it

The MetaTrader Market, along with many sellers, offers ready-to-use robots. Be wary of perfect curves: ask for a verifiable live account history, with its floating drawdown.

Before paying, check whether it hides a martingale or a grid.

Types of automated strategies

  • Trend following: follows the dominant move. It wins less often, with large gains when it does.
  • Mean reversion: bets that price comes back after moving away. It racks up frequent wins with occasional larger losses.
  • Breakouts: trades when price leaves a range, often at a session open.
  • Scalping: goes for a few pips in very short trades. It depends heavily on costs.
  • Grid or martingale: averages against price. It carries a risk you should understand beforehand.

No type is best at all times. Each one shines in a particular market environment, which is why combining them makes sense.

1. From backtest to a reliable strategy

Everything starts with a simulation on past data, in the MetaTrader Strategy Tester or in StrategyQuant X. The problem is that a backtest can always look good if you tweak its inputs enough.

A reliable backtest, in five checks

  • Many years of history, covering varied market phases.
  • Realistic costs: spread, commission, swap.
  • A held-out period the strategy has never seen.
  • Hundreds of trades, not a few dozen.
  • Similar results when you shift the inputs slightly.

The MetaTrader 5 Strategy Tester can simulate with real ticks, the most faithful option. Use it at least for the final validation, even if it takes longer.

2. Before putting money at risk

A robot that shines in simulation still has to prove itself on new data. That's why it pays to incubate it on a demo account, with criteria set in advance, before moving it to live.

Live trading brings things the backtest didn't charge: variable spread, slippage, commissions, swaps. We explain them in the real cost of each trade. When the live result drifts away from the simulated one, this guide helps you find the cause.

While it incubates, write down what you expect from it: trade frequency, maximum tolerable drawdown, minimum result. With that reference in writing, the decision to go live no longer depends on your mood at the time.

Demo, live or funded

  • Demo: no risk. It's for checking that the EA does what it should.
  • Live with little capital: adds slippage, along with your own reaction to losses.
  • Funded: more capital in exchange for strict rules. It calls for lower risk than in your own account.

3. Putting it to work

An EA only works while its terminal is open and connected. If your computer shuts down, the robot stops with it.

Start with the minimum lot. The first weeks are for confirming that live execution resembles the demo, not for making money.

4. Controlling risk

The strategy chooses when to enter. You decide how much to risk. That figure, together with the robot's worst streak, determines how deep the account's drawdown will go.

Also set a cap for the whole account. If the combined drawdown reaches it, you stop all systems to review calmly.

5. Monitoring it live

Every profitable robot has bad months. The hard part is telling a normal streak apart from a strategy that has lost its edge, without switching it off out of nerves or letting it run out of laziness.

The key is to compare the current drawdown with its own history, setting the limit for switching off before you get there. We cover it in is your robot broken or just in a bad streak?

6. Robots on funded accounts

Prop firms lend capital in exchange for following their rules. A robot that doesn't know them can blow the challenge in a single day, even if its strategy is good.

What each company requires, checked on its official website, is in prop firm rules.

A review routine

  • Every day: that the terminals are still connected, with Algo Trading switched on.
  • Every week: each robot's result against what you expected, plus the costs.
  • Every month: the current drawdown compared with the historical one.
  • Every quarter: the correlation between systems, along with how capital is allocated.

Beginner mistakes

  • Going live after two good weeks on demo.
  • Risking too much because the backtest "never" fell that far.
  • Running ten robots that are basically doing the same thing.
  • Switching a system off at its first slump, then turning it back on once it has already recovered.
  • Not writing down what changes you make or when.

Key terms, close at hand

If you get lost with any word (drawdown, out of sample, swap, payout), each one is explained in the algorithmic trading glossary.

Frequently asked questions

What is algorithmic trading?

Algorithmic trading means trading the markets with rules written into a program, which opens or closes orders without manual intervention. In MetaTrader these programs are called Expert Advisors (EAs).

Can you make money with trading robots?

Some systems keep an edge for years; many others lose it. No EA guarantees profits, so each one needs to be validated, risk-controlled and monitored.

What's the difference between MetaTrader 4 and MetaTrader 5 for EAs?

MetaTrader 5 has a more complete Strategy Tester, with real ticks or several symbols at once. MetaTrader 4 is still in use because of the large number of older EAs. A robot built for one doesn't run on the other without being adapted.

Do I need to know how to code to use trading robots?

Knowing how to code isn't essential. You can generate strategies with visual tools or buy them. Understanding the basics helps you spot mistakes.

How much money do I need to start algorithmic trading?

To learn, nothing: a demo account is enough. Live, it depends on your broker's minimum lot, as well as the risk per trade you choose.

Put your robots in orbit.

Try it free

Sign up in a minute, no card required.