Guide 9 of 10

Expert Advisors (EA): Install, Activate & Backtest

Run automated trading systems on MT4 and MT5 — from installation to live trading.

What is an Expert Advisor?

An Expert Advisor (EA) is an automated trading program written in MQL4 (MT4) or MQL5 (MT5) that runs on MetaTrader and executes trades automatically based on predefined rules. EAs range from simple moving average crossover bots to complex algorithmic systems used by hedge funds.

Installing an EA

1

Get the EA file (.ex4 for MT4, .ex5 for MT5)

EAs are distributed as compiled .ex4/.ex5 files (ready to use) or .mq4/.mq5 source code files (need compilation). Download from MQL5 Market, a vendor, or write your own.

2

Open the MT4 data folder

In MT4: File → Open Data Folder. Navigate to MQL4 → Experts (or MQL5 → Experts for MT5). Copy your .ex4 file into this folder.

3

Refresh the Navigator

Back in MT4, press F5 or right-click in the Navigator → "Refresh." Your new EA appears under Expert Advisors in the Navigator panel.

Activating an EA on a Chart

1

Drag the EA onto the chart

Or double-click it in Navigator. The EA settings dialog opens. Configure parameters like lot size, SL/TP, and strategy-specific inputs. The EA author should provide documentation for all parameters.

2

Enable automated trading

Check "Allow live trading" in the EA settings. Also ensure the global "AutoTrading" button in the MT4 toolbar is enabled (shows green when active). Both must be enabled for the EA to trade.

3

Verify the EA is running

A small smiley face icon appears in the top-right corner of the chart when an EA is active. A grey face = AutoTrading is disabled or EA has an error. Check the Journal tab in Terminal for any error messages.

Backtesting an EA

Backtesting runs the EA on historical data to see how it would have performed. Open the Strategy Tester: View → Strategy Tester (Ctrl+R).

1

Select your EA and settings

Choose the EA, symbol, model (Every tick = most accurate), timeframe, and date range. Set initial deposit to match your real account size.

2

Click Start

The tester runs through historical data. Progress shows at the bottom. For months or years of data, testing may take minutes. When complete, the Results and Graph tabs show performance metrics.

Key backtest metrics to check:

Profit Factor — total profit ÷ total loss. Should be >1.5 for a viable strategy. Max Drawdown — largest peak-to-trough loss. Should be manageable (under 20%). Win Rate — combined with profit factor, tells you about the strategy's distribution of wins and losses.

Beware of curve fitting:

A backtest that looks perfect was likely optimized specifically for that historical data ("curve fitted") and will fail on live markets. Always test on out-of-sample data (periods not included in optimization) and use a demo account for at least 3 months before going live.

← Price Alerts Next: Keyboard Shortcuts →