CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. Most retail investor accounts lose money when trading CFDs. PipTax compares costs; it is not investment advice.
Guide · MetaTrader

How to use Expert Advisors (EAs) in MT4 & MT5

An Expert Advisor is a program that trades a MetaTrader account for you, following rules someone has written in code. This is the plain-English version: what an EA actually does, how to install one, how to switch it on safely, and how to configure its settings — the bit most people get stuck on.

On this page: What an EA isHow it worksInstalling one Turning it onConfiguring inputs Common mistakesMT4 vs MT5

What is an Expert Advisor?

An Expert Advisor (EA) is an automated trading program that runs inside MetaTrader 4 or 5. It watches the market according to rules written in code (the MQL language), and when those rules are met it can open, manage and close trades on your account — without you clicking anything. People also call them trading robots or bots.

An EA can do as little as move a stop-loss for you, or as much as run an entire strategy 24 hours a day. What it can't do is guarantee a profit — an EA only ever executes the rules it was given, well or badly.

How an EA works

Every time the price moves, MetaTrader hands the new price to the EA. The EA runs its rules, decides whether to do anything, and — if a rule fires — sends an order to your broker. Then it waits for the next price tick and does it all again.

Market price ticks, every move EA rules & logic "if X then buy/sell" Your broker order executed loops on every new tick
An EA reacts to each price tick, applies its rules, and only then places an order.
Because an EA can fire on every tick, an active strategy may place a lot of trades — which is exactly why trading cost matters so much with EAs. A rule that's barely profitable before costs can be a loser after spread and commission. Run your EA's statement through the cost audit to see its true cost.

Installing an EA

An EA file ends in .ex4 (MT4) or .ex5 (MT5) — the compiled program — and sometimes comes with a .mq4/.mq5 source file. To install it:

  1. In MetaTrader, open File → Open Data Folder. This opens the exact folder MetaTrader reads from.
  2. Go into MQL4 → Experts (or MQL5 → Experts on MT5) and copy the EA file in there.
  3. Back in MetaTrader, right-click Navigator → Refresh. The EA now appears under "Expert Advisors".
  4. Drag the EA from the Navigator onto a chart of the symbol and timeframe you want it to run on. A settings window opens.
Navigator ▸ Indicators ▾ Expert Advisors MyStrategy EA EURUSD, H1 drag onto chart
Drop the EA onto the chart for the market and timeframe you want it to trade.

Turning it on: AutoTrading

Installing an EA does not let it trade yet. Two switches have to be on:

  1. In the EA's settings window, on the Common tab, tick "Allow live trading" (older builds: "Allow Automated Trading").
  2. On the main toolbar, click the AutoTrading button so it is green. If it is red, the EA will not place trades.

When it's working you'll see a small smiley face 🙂 in the top-right corner of the chart. A sad face ☹ or an means something is off — usually AutoTrading is disabled.

Safety first. Test on a demo account before risking real money, and understand that "Allow live trading" means the EA can place real orders on its own. Most retail accounts lose money trading CFDs — an EA does not change that risk.

Configuring the inputs

This is where most people get stuck. The Inputs tab of the settings window is a list of the EA's adjustable settings — the "dials" the developer exposed. Double-click a value to change it. Common inputs include:

Inputs Variable Value Lots0.10 StopLoss (pips)30 TakeProfit (pips)60 MaxSpread (pips)2.0 TradingHours07–20 MagicNumber12345
Typical EA inputs. Names vary by EA — always read the developer's notes for what each one does.
Inputs like Lots and MaxSpread interact directly with your broker's costs. A tighter MaxSpread avoids expensive fills; a bigger Lots multiplies every cost. See what a given size really costs on the cost tool.

Common mistakes

MT4 vs MT5: what changes

Running an EA? Know what it really costs.

EAs trade often, so cost is frequently the difference between a winning and a losing system. Upload your statement and see your true cost per trade, plotted across the month, and which broker would run your EA cheapest.

Audit my statement →

This guide is general educational information about how MetaTrader works. It is not trading advice, not a recommendation of any EA or strategy, and not a promise of any outcome. Trading CFDs is high-risk and most retail investor accounts lose money.