Pips & GoldForex & gold, explained.
Learn

What is an EA (Expert Advisor)?

By the Pips & Gold team · Facts checked October 21, 2026 · Page edited October 27, 2026

Education only, not financial advice. Trading with leverage can lose money fast, sometimes more than you deposit.

An Expert Advisor, or EA, is a program that trades for you inside MetaTrader. It follows fixed rules without fear, greed or sleep. That is its strength and its weakness: an EA will follow bad rules just as faithfully as good ones. This guide explains how EAs work, the main types, how to read the evidence behind them, and how to run one without betting the account on a sales page.

8 min readLevel: All levels

Key takeaways

  • An EA is a program (.ex5 file for MT5) that reads prices and opens, manages and closes trades by fixed rules.
  • It only works while MetaTrader is running with Algo Trading switched on, which is why many people use a VPS.
  • Backtests are easy to over-fit. Forward tests and verified live accounts are much stronger evidence.
  • Martingale and grid EAs can show smooth profits for months, then lose most of an account in one move.
  • Most EAs lose money over the long term. Judge any EA by worst drawdown, costs and live results, then start on demo or a cent account.

What an EA is

MetaTrader 4 and 5 include a programming language, MQL4/MQL5. An Expert Advisor is a program written in it that is attached to a chart and reacts to each new price (a “tick”). It can do anything a trader can do with the mouse: open trades, set stops and targets, move stops, close trades and show information on the chart.

What an EA does, many times a secondNew price(a tick arrives)Check rulesindicators, time, riskActopen, modify or closeRecordlog, dashboardRuns only whileMT5 is openPC or VPSAlgo Tradingbutton ON24/5 = use a VPS
The loop repeats on every tick, for as long as MT5 is running.
Program typeWhat it doesTrades for you?
Expert Advisor (EA)Opens, manages and closes trades by its rulesYes
IndicatorDraws lines or values on the chart (e.g. moving average, ATR)No
ScriptRuns once, e.g. “close all trades”One action only
Utility / panelHelps you trade by hand (e.g. a dashboard, risk calculator)Only when you click

How an EA runs in MT5

  1. The EA file (.ex5) goes in the MQL5/Experts folder (File → Open Data Folder).
  2. You drag it from the Navigator onto a chart of the symbol it trades, on the timeframe its manual specifies.
  3. You set its inputs (risk mode, lot or risk %, session filters, magic number) and tick Allow Algo Trading.
  4. The Algo Trading button on the toolbar must be green. A small hat or icon in the chart corner shows the EA is active.
  5. The Experts and Journal tabs in the Toolbox show what the EA is doing and any errors.
Why a VPS?An EA stops when your computer sleeps, loses internet or restarts. A VPS (virtual private server) is a small computer in a data centre that runs MT5 around the clock for a monthly fee. Many EA users rent one close to their broker's servers to reduce delays.
One account, one planRunning several EAs on one account multiplies risk, and two EAs on the same symbol can interfere unless each uses its own magic number. Keep a list of what is running where.

The main types of EA

TypeIdeaTypical resultsMain risk
Trend-followingBuy strength, sell weakness, ride movesMany small losses, a few big winsLong flat or losing periods in ranges
Mean-reversion / rangeFade moves back to an averageMany small winsA strong trend can produce a large loss
Breakout / sessionTrade the break of a range, e.g. the Asian session high/lowBursts of activity at session opensFalse breakouts, spreads at the open
ScalperMany tiny tradesHigh win rate, thin edgeCosts, slippage and broker differences eat the edge
Grid / recoveryAdd trades at set distances, close the basket in profitSmooth equity, until it isn'tDeep drawdowns in one-way moves
MartingaleIncrease size after lossesVery high win rateA losing streak can wipe the account

Before you run any EA, find out which of these styles it uses; a good product page explains its style and its risks.

Backtests, forward tests and live results

How much to trust each kind of evidenceVerified live account (months)Forward test on demoBacktest on real tick dataBacktest on rough data / screenshotsMosttrustLeasttrust
Treat claims at the bottom of the pyramid as marketing until proven higher up.

A backtest runs the EA over past prices in MT5's Strategy Tester. It is fast and useful, but it is easy to tune an EA until the past looks perfect. That is called curve fitting or over-optimisation: the settings memorise history instead of capturing a real edge.

A forward test runs the EA on a demo account in real time. A live verified account (for example tracked by Myfxbook with real money) is the strongest evidence, especially over many months with losing periods shown. See how to backtest an EA in MT5.

NumberWhat it tells youRough guide
Maximum drawdownThe worst fall from a peakAsk: could I live with double this?
Profit factorGross profit ÷ gross lossBelow 1.2 is fragile after real costs
Number of tradesHow much evidence there isHundreds are better than dozens
ExpectancyAverage profit per trade after costsMust be clearly above zero
ConsistencyResults by year and by monthProfits shouldn't come from one lucky period

Expectancy: will the rules make money on average?

Every EA, however clever, boils down to how often it wins, how much it wins, how much it loses, and what each trade costs.

Expectancy = (win rate × average win) − (loss rate × average loss) − costs per trade

Worked example

A 55% win rate that still loses

An EA wins 55% of trades. Average win $40, average loss $45, costs $3 per trade.

Wins: 0.55 × $40 = $22.00 Losses: 0.45 × $45 = $20.25 Costs: $3.00 Expectancy = 22.00 − 20.25 − 3.00 = −$1.25 per trade 40 trades a month → about −$50 a month

Winning more often than losing is not enough. The size of wins and losses, and costs, decide the result. Change the numbers below to see what an EA needs.

EA expectancy calculator

For learning only. Brokers differ in contract sizes and rounding, so always check your broker's contract specification.

Why martingale and grid EAs are dangerous

A martingale EA doubles its size after each loss, so one win recovers everything. It feels unbeatable because most sequences end in a win. The maths says otherwise.

Martingale: double the lot after every loss (10-pip stop, EUR/USD)0.01−$10.02−$30.04−$70.08−$150.16−$310.32−$630.64−$1271.28−$2552.56−$5115.12−$1,023Lot size on each trade (bottom) and total loss so far (top). Ten losses: −$1,023 and the next trade is 10.24 lots.
Ten losses in a row is not rare over hundreds of sequences. Few accounts can afford the eleventh trade.
Worked example

The cost of a losing streak

Start at 0.01 lot on EUR/USD with a 10-pip stop ($1 risk). Double after each loss.

Loss 1: 0.01 lot → −$1 total −$1 Loss 5: 0.16 lot → −$16 total −$31 Loss 8: 1.28 lot → −$128 total −$255 Loss 10: 5.12 lots → −$512 total −$1,023 Trade 11 needs 10.24 lots just to win back $1,023 + $1

Grid EAs work differently but share the weakness: in a long one-way move they keep adding positions, and the open loss grows faster than the account. Many show a beautiful equity curve right up to the day they don't. If you run one, use strict account-level loss limits and treat the deposit as fully at risk.

Red flags when buying an EA

  • Promises of fixed monthly returns (“10% a month guaranteed”).
  • Only backtests or screenshots, no verified live account.
  • Live results that begin recently, or that hide drawdown by showing balance only.
  • No stop losses, or martingale/grid logic not disclosed.
  • Pressure to buy now, “only 3 copies left”.
  • Requests to trade through a specific unregulated broker or to send money to a person.
  • No manual explaining inputs and risks.
A safe way to try any EADemo first for a few weeks, then a cent account (see account types), then a small standard account. Set a loss at which you will stop it, write it down, and stick to it.

Your first EA: a safe 90-day plan

Excitement is the enemy of a new EA. A slow, staged start costs a little time and can save a lot of money.

Four stages before real size1Weeks 1–2Read the manual.Backtest with real ticks.2Weeks 3–6Demo forward test,same broker and VPS.3Weeks 7–12Cent account or tinyreal size, Conservative.4After 90 daysCompare live vs test.Scale only if similar.
Worked example

Writing down your stop rule

You start an EA on a $1,000 account. Its backtest showed a maximum drawdown of 18%.

Planned worst case = 2 × backtest drawdown = 36% Your personal stop rule: switch off if equity falls below $700 (−30%) Review rule: if live drawdown passes 18% within 3 months, pause and investigate

Write the numbers down before you start. A rule you set while calm beats a decision made in the middle of a losing week.

What to record each weekEquity (not just balance), the deepest drawdown so far, number of trades, average spread paid, and any errors in the Experts tab. Compare them with the backtest. Big differences mean something is wrong: settings, broker, costs or the EA itself.

Going deeper: notes for experienced traders

  • Walk-forward testing: optimise on one period, test on the next unseen one, and repeat. Settings that only work in-sample are curve-fitted.
  • Monte Carlo: reshuffle trade order and vary spreads and slippage to see a range of drawdowns rather than one lucky path.
  • Broker sensitivity: scalpers and news EAs can behave very differently across brokers due to spreads, execution and stop levels. Test on the broker you will use.
  • Every tick based on real ticks in the MT5 tester is the most realistic mode; check the tester's spread settings and add commission.
  • Licensing and updates: sale EAs are usually locked to an account number; keep your licence details and update logs.

Common mistakes

  1. Believing a perfect backtest. It is often curve fitting. Look for forward and live results.
  2. Running an EA on a laptop that sleeps. Trades stop being managed. Use a VPS for 24/5 EAs.
  3. Ignoring how the EA handles losses. Martingale and grid logic can turn a normal bad week into a disaster.
  4. Starting with real money and full risk. Demo, then cent, then small. Increase only after months of evidence.
  5. Judging by win rate. A 90% win rate with rare huge losses can still lose money.
  6. Running several EAs without a total risk limit. Their worst periods can arrive at the same time.

Printable checklist

  • I know what style the EA trades and how it handles losing trades.
  • I checked its worst drawdown and could accept double it.
  • I saw forward or verified live results, not only backtests.
  • I backtested it myself with real ticks and my broker's costs.
  • It uses hard stops on the server, or I understand why it doesn't.
  • It runs on a VPS or a computer that stays on.
  • I started on demo or a cent account.
  • I wrote down the loss at which I will switch it off.

Frequently asked questions

Do EAs really work?

Some make money for a while, and a few for a long time. Most lose over the long term, especially after costs. Treat any EA as a high-risk tool and judge it by live evidence.

Can I run an EA on a Mac or phone?

EAs run in the desktop MetaTrader terminal. Mobile apps can't run EAs. On a Mac you can use MT5's Mac version or, more reliably, a Windows VPS.

Do I need a VPS?

If the EA must run 24 hours a day, five days a week, a VPS is the reliable way. If your EA only trades a few hours and your computer stays on, you may not need one.

What is a magic number?

An ID the EA stamps on its trades so it only manages its own positions. Each EA (and each copy on the same symbol) should have a different one.

Are EAs legal?

Yes. Brokers that offer MetaTrader generally allow EAs, though some restrict certain strategies such as high-frequency scalping. Check your broker's terms.

How do I know if an EA's results are real?

Look for a third-party verified live account with a long history, showing equity (not just balance) and drawdown. Be wary of screenshots.

Risk warning: most EAs lose money in the long runTrading forex and gold with leverage is high risk and you can lose all of your deposit. Most Expert Advisors do not make money over the long term. Every result shown here is a backtest on past prices, not live trading, and past results do not promise future results. Live results will be different because of spreads, commission, slippage and changing markets. This is not financial advice. Test on a demo account first and only trade money you can afford to lose. Full risk disclaimer.

Sources and further reading

This guide is general education, not financial advice. Broker terms differ; always check your own broker's contract specifications.