Pillar guide
MT5 Expert Advisors: The Complete Guide to Choosing, Testing, Installing and Running an EA
By Benjamin Lee · Updated · 8 min read
An Expert Advisor, or EA, is a program that trades your MetaTrader 5 account by a fixed set of rules. The idea is simple. The decisions around it are not: which kind to use, how to size it, how to test it, whom to buy from, and what to do when it misbehaves. This is the map. Each section answers one question briefly and points to the full guide on that topic, so you can follow a path from first understanding to a live account, in the order that protects your money.
Key takeaways
- An EA follows rules without emotion, but it cannot predict the market and it does not remove risk.
- Choose a strategy type you understand before you look at results. Grid and martingale carry the sharpest tail risk.
- Size every trade from a risk limit you set first. Lot size, not the EA, decides how bad a bad week is.
- Test in this order: real-ticks backtest, demo forward test, then the smallest live lot.
- Verify claims yourself. A screenshot of profit is not evidence, and a licence you did not read is not a licence.
What an MT5 Expert Advisor is and is not
An Expert Advisor is a compiled MQL5 program, a file ending in .ex5, that runs inside the MetaTrader 5 terminal. It reads prices and indicators, applies its rules, and sends orders to your broker. It can watch the market around the clock while the terminal is running and connected, and it follows its rules every time. It cannot see the future, it does not know about news unless it was coded to, and a strategy that worked in the past can stop working. MetaQuotes explains the platform side in its documentation on trading robots.
Start with the plain-language basics in what is a forex Expert Advisor, then see MT4 versus MT5 to confirm you are on the right platform, and what MQL5 is if you want to know how they are built. The glossary defines every term used here.
Choose a strategy type first
| Style | Idea | Main risk | Read more |
|---|---|---|---|
| Trend or breakout | Follow a move once price breaks a level | Many small losses in ranging markets | Strategy comparison |
| Scalping | Many short trades for small gains | Costs and execution speed decide the result | Scalping EAs explained |
| Mean reversion | Trade back toward an average | One strong trend can cause a large loss | Types of EAs |
| Grid | Add positions as price moves against the first | Open exposure grows without a stop | Grid and martingale risks |
| Martingale | Increase size after a loss | Account can fail after a short losing run | Grid and martingale risks |
If you are new, a style with a stop loss on every trade is easier to understand and to size. The automated versus manual trading guide and the comparison of EAs, copy trading and signals help you decide whether an EA is the right method at all.
Decide your risk before you pick an EA
The most useful number in automated trading is the amount you accept losing on one trade. Many traders pick about 1 percent of the account or less. From that figure and the EA's stop distance you get a lot size. If the broker's smallest lot already risks more than your limit, the account is too small for that EA. Worked examples in euros are in how much money you need to run an EA.
- Lot size and risk management for EAs explains the method.
- The lot size calculator, gold lot size calculator, pip value calculator and margin calculator do the sums.
- Drawdown explained and the drawdown calculator show why a 50 percent loss needs a 100 percent gain to recover.
- The risk and reward calculator checks whether a target is realistic against its stop.
Install, configure and keep it running
Step 1: Install the EA
Copy the .ex5 file to the Experts folder, refresh the Navigator and attach it to the right chart. The steps are in the install guide and the longer safe setup walkthrough.
Step 2: Load the setfile and read the inputs
A setfile is the author's saved settings. See setfile and input settings explained.
Step 3: Give each EA its own magic number
This stops two EAs managing each other's trades. See running multiple EAs.
Step 4: Run it on a VPS
A VPS keeps the terminal online. See VPS for MT5 EAs.
Step 5: Fix problems quickly
If the EA is not trading, start with the AutoTrading and error guide and common MT5 errors.
Test in the right order
Testing is where most protection comes from, and where shortcuts do the most harm. Begin with a backtest in the MT5 Strategy Tester using the mode based on real ticks and your broker's actual costs, which is covered in how to backtest an EA in MT5. Read the report properly with how to read an MT5 backtest report or the shorter Strategy Tester report guide. Know where the data comes from in historical tick data for MT5.
Then guard against false confidence. Optimisation and overfitting explains why a tuned result often fails live, and can EA backtests be manipulated lists the common tricks. Finish with a forward test on demo through a news week, then a live account at the smallest lot.
Pick an instrument you can size
| Instrument | Character | Guides |
|---|---|---|
| Gold (XAUUSD) | Large moves, wide and changing spreads, high value per lot | Best gold EA: how to choose, XAUUSD EA settings, running an EA on gold |
| EURUSD | Deepest liquidity, tight spreads, smaller moves | EURUSD EA guide, spread, slippage and swap |
Other topics that shape results: the best timeframe for EAs and how to choose a broker for an EA. Strategy-specific research is in the VWAP gold breakout research and the scalping broker rules research.
Rules that change the setup: Europe and prop firms
If you trade from the European Union, ESMA's retail CFD rules cap leverage at 30 to 1 on major pairs and 20 to 1 on gold, require a 50 percent margin close-out and give negative balance protection. That changes margin and grid behaviour, and it is covered in EA trading in Europe.
If you plan to use a prop firm challenge, loss limits and rules on third-party EAs matter more than the strategy. Start with using EAs with prop firms, which firms allow EAs, EAs not suitable for prop firms, setting up for a challenge, the FTMO example and the prop firm challenge calculator.
Buy carefully
Most losses on the buying side come from skipped questions. Use the EA buying checklist, learn to verify a track record and spot scams, understand lifetime, subscription and rental licences, and read how to buy a cheap MQL5 EA safely and whether free MT5 EAs are safe. When you are ready to compare products, browse the Expert Advisor catalogue or the gold EAs, and read the refund policy first.
- 1%
- A common per-trade risk limit; many traders go lower
- 3
- Test stages: real-ticks backtest, demo forward test, minimum live lot
- 15
- Questions in the buying checklist
Ten beginner mistakes worth avoiding
- Buying on a screenshot instead of a verifiable record.
- Attaching a new EA straight to a live account.
- Using the default lot size without checking the risk in money.
- Running the EA on the wrong timeframe or symbol name.
- Putting two EAs on one account with the same magic number.
- Leaving Allow DLL imports on for files from unknown sources.
- Optimising settings until the backtest looks perfect.
- Switching EAs after every small loss, so no system gets a fair sample.
- Trading through high-impact news with a strategy that is not built for it.
- Forgetting that the terminal must stay online for the EA to manage trades.
Each one has a fix in the guides above. Work through the checklist in order and most of this list never happens to you.
If you only read five guides
The list above is long on purpose, so you can come back to the part you need. If you want the shortest path, read these five in order. First, the safe setup walkthrough, so you know what installing involves. Second, the guide on backtesting, so you can see how a strategy behaved on past data. Third, the report guide, so you can read what the backtest tells you. Fourth, the buying checklist, so you ask the right questions before you pay. Fifth, the sizing guide, so the first live lot is one you can afford to lose. Everything else deepens one of those five steps.
Sources and further reading
- MetaTrader 5 Help: Algorithmic Trading, Trading RobotsMetaQuotes' overview of Expert Advisors, strategy testing and optimisation in the platform.
- MetaTrader 5 Help: Expert Advisors and Custom IndicatorsHow Expert Advisors and custom indicators work in the terminal.
- MetaTrader 5 Help: Strategy TestingThe Strategy Tester: testing modes, settings and forward testing.
- ESMA: ESMA agrees to prohibit binary options and restrict CFDs to protect retail investorsThe EU leverage limits, margin close-out, negative balance protection and risk-warning rules for retail CFD accounts.
Frequently asked questions
What is an Expert Advisor in MT5?
It is a program that runs inside MetaTrader 5, reads market data, applies a fixed set of rules and places orders on your account automatically. It needs the terminal to be running and connected.
Can an Expert Advisor guarantee profit?
No. No EA can guarantee a result. Markets change, and a strategy that worked in the past can fail. Test it, size it carefully and use only money you can afford to lose.
Do I need coding skills to use an EA?
No. You install the file, load the setfile and attach it to a chart. Coding is needed only to write or change an EA.
How long should I test an EA before going live?
Backtest across several years on real ticks, then forward test on demo for at least a few weeks including a news week, then start live with the minimum lot. There is no fixed time, but short tests prove little.
Do I need a VPS to run an EA?
Not strictly, but the terminal must stay online for the EA to manage trades. A VPS gives you a stable connection and is recommended for any live account.
Which EA should I start with?
Start with a style you can understand and size, with a stop loss on every trade. Compare candidates with the buying checklist, test on demo and keep the first live lot small.
Expert Advisors in these styles
Apply the checks above to any of these before you buy: read the manual, run your own backtest, and start on demo.
Keep reading
- EA basicsHow to Install and Run an EA on MT5Install an Expert Advisor on MetaTrader 5, load a setfile, set safe risk limits, and run it on a VPS. A practical walkthrough with a pre-live checklist.
- BacktestingHow to Backtest an EA in MT5 ProperlyLearn how to backtest an Expert Advisor in MT5 the right way: tester modes, spreads, delays, optimisation, walk-forward checks and the red flags to avoid.
- Buying guideEA Buying Checklist: 15 Questions to Ask Before You Pay15 questions to ask before buying an MT5 Expert Advisor: who built it, licence terms, backtest proof, risk logic, support and refunds, with a printable checklist.
- Risk and sizingHow Much Money Do You Need to Run an EA? Euro ExamplesThe smallest account that can run an Expert Advisor safely: the 1% risk method, minimum lots on EURUSD and gold, margin, costs and euro examples from 500 to 10,000.
- Gold EAsBest Gold EA for MT5: How to Choose One (Checklist)How to pick a gold (XAUUSD) Expert Advisor for MT5: strategy type, spread tolerance, drawdown, proof to ask for, and a 12-point checklist before you pay.
- Forex EAsEURUSD EA for MT5: Settings, Sessions and SpreadHow to run an Expert Advisor on EURUSD in MT5: best sessions, spread and news filters, pip value in euros, swap, server time and a safe testing plan.


