ForexCopilotEA

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

The main EA styles and the risk each one carries
StyleIdeaMain riskRead more
Trend or breakoutFollow a move once price breaks a levelMany small losses in ranging marketsStrategy comparison
ScalpingMany short trades for small gainsCosts and execution speed decide the resultScalping EAs explained
Mean reversionTrade back toward an averageOne strong trend can cause a large lossTypes of EAs
GridAdd positions as price moves against the firstOpen exposure grows without a stopGrid and martingale risks
MartingaleIncrease size after a lossAccount can fail after a short losing runGrid 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.

Install, configure and keep it running

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

  2. Step 2: Load the setfile and read the inputs

    A setfile is the author's saved settings. See setfile and input settings explained.

  3. Step 3: Give each EA its own magic number

    This stops two EAs managing each other's trades. See running multiple EAs.

  4. Step 4: Run it on a VPS

    A VPS keeps the terminal online. See VPS for MT5 EAs.

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

Two common starting points
InstrumentCharacterGuides
Gold (XAUUSD)Large moves, wide and changing spreads, high value per lotBest gold EA: how to choose, XAUUSD EA settings, running an EA on gold
EURUSDDeepest liquidity, tight spreads, smaller movesEURUSD 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
Your path from zero to a live EA
0/12

Ten beginner mistakes worth avoiding

  1. Buying on a screenshot instead of a verifiable record.
  2. Attaching a new EA straight to a live account.
  3. Using the default lot size without checking the risk in money.
  4. Running the EA on the wrong timeframe or symbol name.
  5. Putting two EAs on one account with the same magic number.
  6. Leaving Allow DLL imports on for files from unknown sources.
  7. Optimising settings until the backtest looks perfect.
  8. Switching EAs after every small loss, so no system gets a fair sample.
  9. Trading through high-impact news with a strategy that is not built for it.
  10. 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

  1. MetaTrader 5 Help: Algorithmic Trading, Trading RobotsMetaQuotes' overview of Expert Advisors, strategy testing and optimisation in the platform.
  2. MetaTrader 5 Help: Expert Advisors and Custom IndicatorsHow Expert Advisors and custom indicators work in the terminal.
  3. MetaTrader 5 Help: Strategy TestingThe Strategy Tester: testing modes, settings and forward testing.
  4. 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.

Browse Expert Advisors