Learn

How to add an Expert Advisor to MT5

Installing an EA in MetaTrader 5 takes a few minutes: put the file in the right folder, compile it, attach it to a chart and switch on Algo Trading. Here's each step, plus what to check when an EA won't trade.

Step by step

  1. 1

    Check what file you have

    MT5 runs .ex5 files (compiled) and compiles .mq5 files (source). .ex4 and .mq4 files are for MetaTrader 4 and won't run in MT5 — see converting an MT4 EA.
  2. 2

    Copy it into the Experts folder

    In MT5 go to File → Open Data Folder, then open MQL5 → Experts and paste the file there. Using the Data Folder menu matters: MT5 often keeps its files somewhere other than its install folder.
  3. 3

    Compile it (for .mq5 files)

    Open the file in MetaEditor (press F4 in MT5, then open it) and press F7 or click Compile. The Errors tab at the bottom should say 0 errors; that creates the .ex5 file MT5 actually runs. An .ex5 file skips this step.
  4. 4

    Refresh the Navigator

    Back in MT5, open the Navigator (Ctrl+N), right-click Expert Advisors and choose Refresh. Your EA appears in the list.
  5. 5

    Attach it to the right chart

    Open a chart of the symbol and timeframe the EA was built for, then drag the EA from the Navigator onto the chart (or double-click it).
  6. 6

    Allow Algo Trading and set its inputs

    In the window that opens, tick Allow Algo Trading on the Common tab, review the settings on the Inputs tab (lot size, stops, and so on), then click OK.
  7. 7

    Turn on Algo Trading in the toolbar

    Click the Algo Trading button in MT5's main toolbar so it's switched on. Without it, no EA on any chart can place trades, even with the box ticked in step 6.
  8. 8

    Check the Experts and Journal tabs

    Open the Toolbox (Ctrl+T). The Experts tab shows messages from the EA itself; the Journal shows platform errors such as rejected orders.

If it isn't working

  1. 1

    It's not in the Navigator

    The file is in the wrong folder (use File → Open Data Folder), an .mq5 file hasn't been compiled, or the list needs a Refresh.
  2. 2

    It's attached but never trades

    Check the Algo Trading button, whether the market is open, and whether the EA's conditions have actually occurred yet. A rules-based EA can go days without a signal.
  3. 3

    Orders get rejected

    The Journal tab says why. Common causes: a lot size below your broker's minimum, stops too close to price, or an account that doesn't allow automated trading.
  4. 4

    It stops when you close MT5

    An EA only runs while MT5 is open and connected. To keep it trading around the clock, run MT5 on a VPS.

Before you run it on a live account

Run any new EA on a demo account first, and ideally through MT5's Strategy Tester before that. How to backtest an EA in MT5 walks through it.

Quick answers

Where do I put an EA file in MT5?

In MT5, choose File → Open Data Folder, then MQL5 → Experts. Paste the .mq5 or .ex5 file there and refresh the Navigator.

Why is my Expert Advisor not trading in MT5?

Most often the Algo Trading button is off, Allow Algo Trading wasn't ticked when attaching it, the market is closed, or the EA's entry conditions simply haven't occurred. The Experts and Journal tabs show the reason.

Can I add an EA on the MT5 mobile app?

No. The MT5 mobile apps can't run Expert Advisors. You need the desktop version of MT5 or a VPS, and you can then watch the trades from your phone.

Don't have an EA yet? Create one from your own strategy

Give us your trading strategy

Describe it in plain language and see exactly what your bot will do. Free, no account needed.

Build My EA

Your first EA is free.