How to Use an EA in MT5: Setup, Test, and Run
By FXNook Lab team
To use an EA in MT5, put its compiled .ex5 file in the terminal’s MQL5\Experts folder, refresh the Navigator, attach it to a chart, and allow algorithmic trading in both the terminal and the EA’s properties. Then test it in Strategy Tester and use the Experts and Journal tabs to see whether it initialized, whether trading is permitted, and what happened when it tried to trade.
These steps separate platform setup from the EA’s own rules. An EA can be attached correctly and still make no trades because its entry conditions are not met, its inputs do not suit the test, or the broker rejects a request. A clean installation is only the first part of the check.
1. Install the EA file in MT5
MT5 runs compiled Expert Advisors as .ex5 files. The simplest way to find the correct folder is to open MT5 and select File > Open Data Folder. In the window that opens, go to MQL5, then Experts.
- Copy the EA’s
.ex5file intoMQL5\Experts. You can put it directly inExpertsor in a subfolder, such asExperts\MySystems, to keep files organized. - Return to MT5 and open the Navigator with View > Navigator, or press
Ctrl+N. - Right-click Expert Advisors in the Navigator and choose Refresh. If it does not appear, restart MT5 and look again.
If you received an .mq5 source file instead, MT5 cannot run that source file directly. Open it in MetaEditor, which you can launch from MT5 with F4, and compile it with F7. A successful compile creates an .ex5 file; compiler errors need to be resolved before the EA can run. Save or compile the file in the terminal’s data folder so the resulting .ex5 is where MT5 can find it.
If you cannot see the EA, first make sure you opened the data folder for the same MT5 installation you are using. A computer can have more than one terminal installation, each with a different data folder. Also check that the file is under MQL5\Experts, not under MQL5\Indicators or MQL5\Scripts.
2. Attach the EA to a chart
In the Navigator, expand Expert Advisors and find the EA. Drag it onto the chart you want to use, or double-click its name while that chart is active. MT5 opens the EA’s properties before starting it; the same dialog is available later by right-clicking the chart and choosing Expert List, selecting the EA, and opening its properties.
The chart determines the symbol and timeframe supplied to an EA. For example, attaching an EA to an EURUSD M15 chart normally means its chart events and default price data relate to EURUSD on the 15-minute timeframe. Some EAs can request other symbols or timeframes in their code, so follow the EA’s own instructions rather than assuming every EA is limited to one chart.
Before clicking OK, review the Common and Inputs tabs. The Common tab includes the EA-level permission for algorithmic trading. Inputs contains the values the EA exposes for adjustment; these can include lot size, indicator periods, a spread limit, or trading hours. The actual fields differ from one EA to another.
3. Allow algorithmic trading and check permissions
MT5 has separate controls that can prevent an EA from sending trades. The main Algo Trading control on the toolbar or ribbon enables or disables automated trading at the terminal level. The EA also has an Allow algorithmic trading setting in its Common properties. For live trading, the terminal control must be enabled and the EA must be permitted to trade.
- Switch on Algo Trading in the MT5 toolbar or ribbon. Its appearance changes when the control is enabled; if unsure, hover over it or open the relevant terminal settings rather than relying on color alone.
- Open the EA’s properties on its chart. In the Common tab, enable Allow algorithmic trading, then apply the change.
- Open Tools > Options > Expert Advisors and make sure the terminal-wide option to allow algorithmic trading is enabled. Review any other restrictions on that page, especially options that disable trading after an account or profile change.
- Make sure the account and broker permit trading on the selected symbol. A symbol may be close-only, unavailable for trading, or subject to session restrictions. The terminal can allow EAs while the broker or account still rejects a particular trade.
Look at the chart after attaching the EA: MT5 displays the EA name and a status icon in the chart area. That tells you the EA is attached, but it does not prove that its entry rules are true or that a broker will accept an order. Read the Experts and Journal tabs for initialization messages, trading-permission warnings, and order responses.
Some MT5 trade-server return codes are useful when they appear in a log. 10027 (TRADE_RETCODE_CLIENT_DISABLES_AT) means algorithmic trading is disabled by the client terminal, while 10026 (TRADE_RETCODE_SERVER_DISABLES_AT) means it is disabled by the server. Codes such as 10014 (invalid volume), 10016 (invalid stops), or 10030 (unsupported filling mode) point to a trade request or broker-compatibility issue rather than a missing EA file.
4. Set inputs before starting
Inputs let you configure the choices the EA’s author exposed; they do not rewrite the underlying strategy logic. Changing a moving-average period, for instance, changes the value used by that input, but it does not add a new entry rule or alter other conditions hidden in the EA’s code.
Take a moment to read each input’s name and the EA’s instructions. A field named MaxSpread might be measured in points, not pips, and a time setting might use broker server time rather than your local clock. If the instructions do not explain a value or unit, do not assume its meaning from the label alone.
For a first test, use a small, understandable set of values and record what you chose. Avoid changing several unrelated settings at once: if the EA’s behavior changes, it is then harder to know which input mattered. The same settings may not make sense across symbols with different contract specifications, quote precision, or trading sessions.
5. Test the EA in Strategy Tester
Strategy Tester lets you run an EA against historical market data without attaching it to a live chart. Open it with View > Strategy Tester or press Ctrl+R. Testing is a way to examine the EA under selected historical conditions; it is not a promise of future performance. Past or tested results do not guarantee future results.
- Choose the Expert Advisor in the tester’s EA selector. If it is missing there as well as in the Navigator, revisit the file location and compile status.
- Select the symbol and timeframe that match the test you intend to run. Check that the symbol has historical data for the period and that the EA’s instructions do not require a specific chart setup.
- Set the test date range. A short range can help with a quick setup check; a wider range can expose behavior across different market conditions, but it also takes longer to run.
- Choose a modeling mode that suits the EA. Every tick based on real ticks uses available real tick data and is often the more detailed choice for logic that reacts to intrabar price changes. Other modes, such as 1 minute OHLC or Open prices only, are less detailed and may not represent tick-sensitive behavior in the same way.
- Set the EA’s input values in the tester, and enable visual mode if you want to watch the test on a chart. Visual mode can help show when the EA sees signals or opens and closes positions, but the tester logs are still needed to diagnose failures.
- Click Start. When the test finishes, examine the tester’s results, graph, report, and Journal. Look for initialization errors, trade requests, rejected trades, and whether the EA evaluated the period you selected.
A test with no trades is not automatically a failed test. The EA may have correctly found no qualifying entries in that date range, or one of its filters may have excluded every setup. Compare the tester Journal with the EA’s documented rules and inputs. If the test itself will not start or data is missing, see MT5 Strategy Tester Not Working: Causes and Fixes.
Testing mode matters. An EA that makes decisions on every tick, uses pending orders, or relies on intrabar stop behavior may produce a different test from one run on open prices only. Use a mode that fits the EA’s logic, and do not compare results from different modes as if the test conditions were identical.
6. Confirm it is running and diagnose setup problems
After attaching the EA, open the terminal’s Toolbox and select Experts and Journal. Experts is useful for EA-specific messages; Journal includes broader terminal events such as connections and permission changes. Messages around the time you attached the EA or expected a trade are more useful than a log viewed without a time or action in mind.
| Symptom | What to inspect | Next step |
|---|---|---|
| EA is missing from Navigator | Confirm the file is an .ex5 under this terminal’s MQL5\Experts folder. If you have only an .mq5, check MetaEditor’s compile output. | Compile the source with F7 if needed, refresh Expert Advisors in Navigator, or restart the correct MT5 terminal. |
| EA is attached but trading is disabled | Check the toolbar’s Algo Trading control, the EA’s Common-tab permission, Tools > Options > Expert Advisors, and the Journal for a permission or server message. | Enable the permitted settings and read the logged reason. If the server or account blocks trading, contact the broker or use an eligible account setting. |
| EA starts but places no trades | Read Experts for initialization or rule messages. Compare the chart symbol, timeframe, session, inputs, and current conditions with the EA’s entry filters. | Run a tester check and inspect trade-request responses. If the setup is correct, investigate the EA’s entry logic and broker constraints instead of repeatedly reinstalling it. |
| Trade request is rejected | Find the broker response or return code in the Experts or Journal tab. Volume, stop distance, filling mode, symbol permissions, or market session can matter. | Compare the request with the symbol’s trading conditions and the EA’s inputs. For a code-level issue, use the return details to narrow down what the EA needs to handle. |
An EA that runs but never trades may be following its rules exactly: perhaps a spread filter, trading-hours condition, or signal has not passed. It may also have a logic error, such as a condition that can never be true or a trade path that is never reached. For a focused walkthrough of these cases, see MT5 EA Not Taking Trades: Checks, Causes, and Fixes.
When the logs show that trading is allowed but the EA still waits, inspect the EA’s own conditions and request handling. FXNook Lab’s EA debugger checks the code’s trading paths and can explain what stops it from trading; FXNook Telemetry can show the rules, decisions, orders, and errors of a supported EA while it runs. These tools help investigate code and behavior; they do not make trading outcomes certain.
7. Keep the EA running and monitor it
A locally running EA needs MT5 to remain open and connected. Closing the terminal stops that local EA, and a computer that sleeps, loses its network connection, or shuts down cannot keep processing incoming prices. If you want the EA to operate continuously, use a machine that stays on and connected or a suitable VPS configured to run the terminal.
After setup, make a brief routine of checking MT5’s connection status, the Algo Trading control, the chart with the EA, and the Experts and Journal tabs. Also look for changes after a terminal restart, account switch, symbol change, or profile load, since these can affect whether the chart and permissions are as expected. A VPS does not remove the need to check that the EA is attached, permitted, and reporting the behavior you intended.
For a practical next step, install the EA in the correct data folder, attach it to a test chart, and run one Strategy Tester pass with the documented inputs. If it compiles and initializes but still does not trade, use the logs and the EA debugger to pinpoint the next issue rather than changing settings at random.
Questions
How do I enable an EA in MT5?
Attach the EA to a chart, then enable the terminal’s Algo Trading control and the EA’s Allow algorithmic trading option in its Common properties. Also make sure algorithmic trading is allowed in Tools > Options > Expert Advisors and that your account and broker permit trading on the selected symbol. Use the Experts and Journal tabs to spot any remaining permission errors.
Why is my EA not showing in the MT5 Navigator?
The EA may be in a different MT5 installation’s data folder, outside MQL5\Experts, or present only as an uncompiled .mq5 source file. Use File > Open Data Folder in the terminal you are using, compile source in MetaEditor with F7, then refresh Expert Advisors in Navigator or restart MT5.
Does MT5 have to stay open for an EA to work?
Yes, when the EA is running locally, MT5 must remain open and connected, and the computer must stay awake and online. Closing the terminal stops the local EA. For continuous operation, run the terminal on a suitable always-on computer or VPS.
How can I test an EA in MT5 before using it live?
Open Strategy Tester, select the EA, symbol, timeframe, date range, and a modeling mode suited to the EA’s logic, then start the test. Inspect the results and Journal for initialization messages, trade activity, and rejected requests. A backtest shows behavior under its selected historical conditions; it does not guarantee future results.