Skip to content
FX Handbook

Expert Advisor

Also known as: EA, trading robot

intermediatePlatforms & ToolsUpdated

Expert Advisor: An Expert Advisor (EA) is a program for MetaTrader that can analyse prices and open, manage and close trades automatically according to rules written in MQL4 or MQL5.

How does an Expert Advisor work?

An EA is attached to a chart and runs while the platform is open and connected, unless it is hosted on a remote server. It checks its conditions on each new price and sends orders when they are met. MT4 EAs are written in MQL4 and MT5 EAs in MQL5, so an EA for one platform does not run on the other: MQL4 and MQL5.

How are Expert Advisors tested?

MetaTrader’s Strategy Tester runs an EA’s rules on historical prices. A backtest shows how the rules would have performed under the test’s assumptions, such as spreads and fills; it does not show how they will perform in the future, and results can differ in live trading because of costs, slippage and changing market conditions.

Example

An EA that buys EUR/USD when a 20-period moving average crosses above a 50-period one, with a 30-pip stop loss and a 60-pip take profit, places and manages those orders without manual input. Whether the rule makes money depends on the market, not on the automation.

EAs sold with promises such as “guaranteed profits” may be warning signs of forex scams.

Learn more