New tools are launching soon. Open any tool and choose Notify me to hear first.Chat with us on Telegram

What is an expert advisor (EA)? How forex robots work

What an expert advisor is, how forex robots trade inside MetaTrader 4 and 5, the main strategy types, and what to check before running one on a live account.

Getting started6 min readUpdated

An expert advisor, usually shortened to EA, is a program that trades for you inside MetaTrader 4 or MetaTrader 5. It watches the market, applies a fixed set of rules and opens, manages and closes trades without you clicking a button. Forex traders often call them trading robots or forex bots.

What an expert advisor is

An EA is written in MQL4 (for MT4) or MQL5 (for MT5), the programming languages MetaQuotes built into the platforms. The developer compiles the code into an .ex4 or .ex5 file, which you copy into MetaTrader and attach to a chart. From then on the EA reacts to every new price that arrives on that chart.

The rules can be as simple as “buy when the 50-period moving average crosses above the 200” or as involved as a multi-timeframe model that filters trades by volatility, session and spread. What every EA has in common is that the decisions are mechanical: the same market conditions always produce the same action.

How an EA works

MetaTrader runs an EA through a small set of events. Understanding them explains most of an EA's behaviour.

  1. Start. When you attach the EA, it reads its inputs, checks the account and symbol, and prepares any indicators it uses.
  2. Every tick. Each time a new price arrives, the EA checks its rules. Most EAs only act on a new bar, so a tick in the middle of a candle changes nothing.
  3. Orders. When the rules line up, the EA sends a market or pending order to your broker with a lot size, stop loss and take profit.
  4. Management. On later ticks it may move the stop loss, trail profits, close part of the position or add trades, depending on its design.
  5. Stop. When you remove the EA or close MetaTrader, it stops. Open trades stay open at your broker, with whatever stop loss and take profit they already have.

That last point matters: an EA only works while its terminal is running and connected. Traders who want an EA to trade all week run MetaTrader on a virtual private server close to their broker. Our VPS guide covers how.

Common EA strategies

Most expert advisors fall into a handful of families. Knowing the family tells you more about an EA's risk than its marketing does.

StrategyHow it tradesWhat to watch
Trend followingBuys strength and sells weakness, holding while a move lasts.Many small losses in ranging markets; profits come from a few long trends.
Mean reversionFades stretched moves and expects price to return to an average.High win rate, but a strong trend can produce one large loss.
BreakoutEnters when price leaves a range, often at session opens.False breakouts and slippage around news.
ScalpingTakes many short trades for a few pips each.Very sensitive to spread, commission and execution speed.
Grid and martingaleAdds positions as price moves against it, often with larger lots.Smooth equity until a long trend causes a deep drawdown. Read our grid and martingale guide.
News tradingTrades around scheduled economic releases.Wide spreads, requotes and fast price gaps.

Settings you'll see

Every EA exposes inputs in its settings window. The names vary, but these show up in almost all of them:

  • Lot size or risk percent. A fixed lot trades the same size every time; a risk percent sizes each trade from your balance and stop loss. Our position size calculator shows what a given risk means in lots.
  • Stop loss and take profit. In pips or points. Check whether the EA always sets a stop loss: some only close losing trades by their own logic.
  • Magic number. An ID the EA stamps on its trades so it doesn't touch trades from you or other EAs.
  • Maximum spread. The EA skips trades when the spread is wider than this, which protects scalpers during news and rollover.
  • Trading hours and days. Limits trading to the sessions the strategy was built for.
  • Maximum open trades. Caps how many positions the EA holds at once, an important brake on grid systems.

Developers often ship preset .set files with tested settings for specific symbols. Loading one is quicker and safer than tuning inputs by hand.

What an EA can't do

An expert advisor removes hesitation and fatigue from trading, but it doesn't remove risk. A few limits apply to every EA, however well it is built:

  • It can't adapt beyond its rules. An EA built for a ranging market keeps trading the same way when the market starts trending.
  • Backtests flatter it. A strategy tuned on past data can look perfect on that data and fail on new data. This is called overfitting or curve fitting.
  • Your broker matters. Spread, commission, slippage and execution speed differ between brokers and change live results, especially for scalpers.
  • It can't guarantee anything. Be wary of any EA sold with promised monthly returns. Markets change, and past performance doesn't predict future results.

Before you run one live

A short checklist catches most problems before they cost money:

  1. Read the documentation: which symbols, timeframe and account type the EA expects, and whether it uses a grid or martingale.
  2. Backtest it on good data with realistic spreads. Our backtesting guide walks through the strategy tester.
  3. Run it on a demo account for a few weeks to see how it behaves with your broker's real conditions.
  4. Decide your risk per trade and your maximum drawdown before you start, and size the EA to fit. The risk of ruin calculator shows how those choices play out.
  5. Check practical details: hedging or netting account, minimum lot size, symbol suffixes such as EURUSD.m, and allowed algorithmic trading.
  6. Start live with the smallest size you can, then scale only when live results match the demo.

EA, indicator or script?

MetaTrader runs three kinds of programs, and they're easy to confuse:

TypeWhat it doesTrades on its own?
Expert advisorRuns continuously on a chart and can open, manage and close trades.Yes
IndicatorCalculates and draws values on a chart, such as moving averages, levels or signal arrows. Some send alerts.No
ScriptRuns once when you drop it on a chart, for a single job such as closing all trades.Only once, when you run it

Many traders pair an indicator for spotting setups with manual entries, then move to an EA once the rules are clear enough to automate. If you have a strategy you'd like turned into an EA, our custom development service builds it to your rules.

Frequently asked questions

Are expert advisors profitable?

Some are, for a while, in the market conditions they were built for. No EA is profitable in every market, and a good backtest doesn't guarantee future results. Judge an EA by its drawdown, its trade sample and a live track record, never by a promised return.

Does an EA work on both MT4 and MT5?

No. MT4 runs .ex4 files written in MQL4 and MT5 runs .ex5 files written in MQL5. A developer has to build and test a separate version for each platform.

Do I need to keep my computer on for an EA to trade?

Yes. An EA only runs while its MetaTrader terminal is open and connected. To trade around the clock without your own computer, traders run MetaTrader on a virtual private server (VPS).

Can I run more than one EA at the same time?

Yes. Each EA runs on its own chart, and most use a magic number to tell their own trades apart. Add up the risk of every EA you run, because their losses can happen at the same time.

Do brokers allow expert advisors?

Most retail forex brokers allow EAs on MetaTrader accounts. Some restrict certain strategies, such as very high-frequency scalping or latency arbitrage, so check your broker's terms.

Educational information only, not financial advice. Trading forex and CFDs on margin carries a high risk of losing money. Read our risk warning.

Hear about new tools first

One short email when a tool launches or a big update ships.