What is an Expert Advisor (EA)? How trading robots in MetaTrader work
An Expert Advisor, or EA, is a program that trades for you inside MetaTrader. It follows its rules on every price tick, day and night, without hesitation or emotion. That is its strength, and also the reason it has to be chosen and set up with care.
The definition
An Expert Advisor is an automated trading program for MetaTrader 4 or MetaTrader 5. It is written in the MetaQuotes languages MQL4 or MQL5 and delivered as a compiled file: .ex4 for MetaTrader 4 or .ex5 for MetaTrader 5. Once attached to a chart, an EA can analyse prices, open and close trades, move stop losses, delete pending orders and show information on the chart, all according to the rules its developer wrote.
People also call EAs "trading robots" or "trading bots". The idea is the same: a fixed set of rules executed automatically.
How an EA works
MetaTrader receives a new price from your broker several times per second when the market is active. Each new price is called a tick. Every time a tick arrives, the EA runs its logic:
- It reads the current prices, time and account information.
- It checks its conditions: is it the right time, is the price at the right level, is there already a trade open?
- If the conditions are met, it sends an order to the broker, or modifies or closes an existing one.
- It manages open trades, for example by trailing the stop loss.
Some EAs also use a timer or download data from the internet, for example an economic calendar, which requires permission in MetaTrader's settings.
What an EA can and cannot do
What an EA does well:
- Follows its rules exactly, every time, without fear or greed.
- Reacts in milliseconds, which matters for news trading and fast markets.
- Watches the market 24 hours a day, including at night and during releases you would otherwise miss.
- Manages many details at once: timing, order distance, stop loss, trailing stop.
What an EA cannot do:
- It cannot guarantee profit. It only executes a strategy, and every strategy has losing periods.
- It cannot adapt to situations its rules do not cover, unless the developer planned for them.
- It cannot trade if MetaTrader is closed, the computer is off or the internet connection is down.
- It cannot change your broker's conditions: spread, slippage and execution still apply.
The main types of EA
- Trend and breakout EAs enter when price moves out of a range, expecting the move to continue.
- News EAs trade around scheduled economic releases, often with pending orders on both sides of the price.
- Session EAs trade a specific window of the day, such as the open of a particular market.
- Scalping EAs aim for many small profits and are very sensitive to spread and execution speed.
- Grid and martingale EAs add positions or increase the lot after losses. They can show smooth results for a long time and then lose a large part of the account in one bad move. Be very careful with them.
EAs are different from indicators, which only show information on the chart and never trade, and from scripts, which run once and stop.
What you need to run an EA
- A MetaTrader account matching the EA version: an .ex4 file only works in MetaTrader 4, an .ex5 file only in MetaTrader 5.
- Algo Trading enabled: the Algo Trading (or AutoTrading) button in the toolbar must be on, and "Allow algorithmic trading" ticked in the EA's settings.
- WebRequest permission if the EA uses the internet, for example to check a license or load a calendar. You add the required address in Tools, Options, Expert Advisors.
- One chart per EA, on the right symbol. Each EA uses a magic number to recognise its own trades, which lets several EAs run on the same account without interfering.
- A computer that stays on, or better, a VPS.
Our installation guide shows each of these steps with screenshots.
Why a VPS helps
A VPS (virtual private server) is a computer in a data centre that runs MetaTrader for you around the clock. It keeps the EA running when your own computer is off, protects you from power cuts and home internet problems, and, if the server is close to your broker, reduces the delay between your terminal and the broker. For news and session strategies, where seconds matter, that lower delay can reduce slippage. MetaTrader also offers a built-in virtual hosting service, and many companies rent Windows servers for trading.
How to judge an EA before buying
- Look for a live forward test, not only backtests. A public signal on a real account shows how the EA behaves with real spreads and slippage. Our guide on reading an MQL5 signal explains what to check.
- Check the drawdown, not only the growth. See our article on drawdown.
- Understand the general approach. You do not need the source code, but you should know what the EA trades, when, and whether it uses a stop loss.
- Avoid promises of guaranteed or fixed monthly profit. No honest developer can promise that.
- Be careful with martingale and grid systems, especially when the seller does not say so clearly.
- Check support and updates: who helps you install it, and what happens when MetaTrader or your broker changes something.
- Start small. Run the EA on a demo account or with a small lot first, and increase only after you have seen it work on your own broker.
Backtest and forward test in one paragraph
A backtest runs the EA on historical data in MetaTrader's Strategy Tester. It is fast and useful for development, but it can be too optimistic, especially for news strategies, because it cannot fully reproduce real spreads, slippage and execution. A forward test runs the EA on a live or demo account in real time. It takes longer, but it is the closest thing to what you will actually experience.
Key takeaways
- An EA is a program for MetaTrader 4 (.ex4) or MetaTrader 5 (.ex5) that trades automatically by fixed rules.
- It reacts to every price tick, but only while MetaTrader is running and connected.
- EAs remove emotion and react fast, but they cannot guarantee profit or change broker conditions.
- You need Algo Trading enabled, the right chart, WebRequest permission if required, and ideally a VPS.
- Judge an EA by its live forward test and drawdown, not by promises or backtests alone.
Trading carries a high level of risk and may not be suitable for everyone. This article is for education only and is not financial advice. Past results do not guarantee future results.