Forex Expert Advisors (EA)

How Expert Advisors work on MetaTrader, how to test one properly, and what to check before letting it near a funded account.

What an Expert Advisor is

An Expert Advisor is an automated trading program written for MetaTrader 4 or 5 in the MQL language. It attaches to a chart and trades that instrument according to its rules.

EAs are the most widely used form of retail trading automation, largely because MetaTrader is supported by most forex brokers and the strategy tester is built in.

MT4 versus MT5 for automation

MT4 uses MQL4 and remains the standard for currency trading, with by far the largest library of existing EAs.

MT5 uses MQL5, supports more asset classes and more timeframes, and has a considerably better strategy tester — including multi-currency testing and more realistic modelling of execution. For new development, MT5 is generally the better choice; for access to existing EAs, MT4 still has the depth.

Installing and running one

  • Copy the EA file into the platform's Experts folder and restart, or use the data folder shortcut in the File menu.
  • Enable algorithmic trading in the platform settings — EAs cannot trade with it switched off.
  • Attach the EA to a chart of the instrument and timeframe it was designed for. Timeframe matters: an EA built for the hourly chart will behave completely differently on the five-minute.
  • Set its inputs deliberately rather than accepting defaults, particularly lot size and risk settings.
  • Confirm the smiling face indicator on the chart, which means it is live.

Testing before going live

Use the strategy tester with the highest quality tick data you can get, and set spread and commission to realistic values rather than the optimistic defaults.

Then optimise carefully, if at all. The tester makes it trivial to search thousands of parameter combinations and find one that produces a beautiful equity curve on that specific history. That result is usually meaningless — it describes the past. Validate any chosen settings on a period the optimisation never touched.

Then run on a demo account for weeks. The tester cannot model slippage, requotes or the way spreads widen around news.

Practical points that catch people out

  • The EA stops when MetaTrader closes — which is why serious use means a VPS, not a home laptop.
  • Broker differences matter: symbol names, digits and stop-level restrictions vary and can prevent orders being placed.
  • Many EAs sold on the strength of spectacular results use martingale or grid sizing, which increases position size after losses. These produce long smooth equity curves and then lose the entire account in a single run.
  • Check whether the EA sets a stop loss on the broker side or holds it internally. Internal stops disappear if the platform disconnects.

Common questions

What is the difference between an EA and a trading bot?

An Expert Advisor is a trading bot written specifically for MetaTrader. 'Trading bot' is the general term and includes systems built on broker APIs outside MetaTrader entirely.

Do I need a VPS to run an EA?

For any serious use, yes. An EA only runs while MetaTrader is open and connected, so a home machine means it stops when the computer sleeps or the power goes — potentially with a position open.

Are martingale EAs safe?

No. Doubling position size after a loss produces an impressively smooth equity curve until the losing streak that exceeds the account, at which point it loses everything. The long run of small wins is what makes it look safe, and that is precisely the trap.

Trading carries risk and you can lose money. Nothing on this page is financial advice. Past performance does not indicate future results.