⚠️ Risk warning: CFDs and leveraged forex are complex instruments with a high risk of losing money rapidly. Most retail accounts lose money. This content is education only, not investment advice or a recommendation.
Run an Expert Advisor on a chart
- Find the EA. Open the Navigator and expand Expert Advisors. EAs you download from the Market or the Code Base appear here.
- Attach it. Double-click the EA or drag it onto a chart. Only one EA can run on a chart at a time.
- Allow it to trade. On the Common tab tick “Allow Algo Trading” (shown as “Allow Auto Trading” in some builds and in the MetaTrader 5 Help), then check the Inputs tab and click OK.
- Turn on the master switch. Click the Algo Trading button on the toolbar (called AutoTrading in the MetaTrader 5 Help). While it is off, no EA can trade.
- Check it is running. The EA's name and icon appear in the top-right corner of the chart. A “not allowed” icon means trading is switched off for it.
Backtest it in the Strategy Tester
- Open the tester. In the Navigator, right-click the EA and choose Test. Make sure the symbols it trades are shown in Market Watch.
- Pick symbol, period and dates. Choose the symbol, the timeframe and a date range. The start date is included and the end date is not.
- Choose the tick mode. “Every tick based on real ticks” is the closest to real trading; “1 minute OHLC” and “Open prices only” are faster but rougher. Avoid “profit in pips” for anything but a quick look: it ignores swaps, commissions and margin.
- Add delays and a forward period. Set a Random Delay to simulate slower execution, and a Forward period (for example 1/3) so the last part of the dates is tested on parameters chosen from the first part.
- Set deposit and leverage, then Start. Use the amount and leverage you would really trade with. Tick Visual mode to watch the trades on a chart, or read the Results tab afterwards.
Common problems
- The EA icon shows it is not allowed to trade
- Tick “Allow Algo Trading” in the EA's Common tab and turn on the Algo Trading button on the toolbar.
- “Autotrading disabled by client terminal” (10027)
- The master Algo Trading button is off. Click it to turn it on.
- “Autotrading disabled by server” (10026)
- Your broker does not allow EAs on this account. Only the broker can change it.
- The tester shows no trades
- Check the Journal tab in the tester for messages, the date range, and that the symbols the EA needs are in Market Watch.
Frequently asked questions
Is an Expert Advisor safe to use?
An EA follows its code exactly, including its mistakes. Use EAs only from sources you trust, test them on a demo account, and never allow DLL imports for unknown programs.
Which tick mode should I use in the MT5 Strategy Tester?
“Every tick based on real ticks” is the most realistic. Faster modes such as “Open prices only” are useful only for EAs written to work on bar opens.
Can I build an EA without coding?
MetaEditor (press F4) includes the MQL5 Wizard, which generates an EA from ready-made signal and money-management modules.