An Expert Advisor (EA) is a program that runs inside a trading terminal — most commonly MetaTrader 4 or MetaTrader 5 — and follows a fixed set of rules. It can read prices and indicators, open and close positions, move stop-losses and manage orders without a person clicking the buttons. MetaTrader 4 EAs are written in MQL4, MetaTrader 5 EAs in MQL5.

The idea is simple: if a trading approach can be described precisely enough, a computer can execute it consistently, around the clock, without hesitation or fatigue. What the computer cannot do is make a weak idea good.

How an EA is built

Almost every EA, however it is marketed, contains the same building blocks:

  • Entry logic — the conditions that trigger a trade, for example a moving-average crossover, a breakout of a range, or a signal from a statistical model.
  • Exit logic — stop-loss, take-profit, trailing stop, time-based exit or an opposite signal.
  • Position sizing — how large each trade is, either a fixed lot or a percentage of the account balance.
  • Filters — spread limits, trading-session windows, news filters and limits on the number of open positions.
  • Housekeeping — error handling, reconnection, slippage limits and logging.

Common EA families

TypeBasic ideaTypical weakness
Trend-followingBuys strength, sells weakness, aims to ride long moves.Many small losses in sideways markets.
Mean reversion / rangeFades moves away from an average, expects a return.Large losses when a range breaks into a trend.
BreakoutTrades the break of a session high/low or volatility band.False breakouts, sensitivity to spread and slippage.
ScalpingVery short holding times, small targets.Highly dependent on execution quality and costs.
GridPlaces orders at fixed intervals above and below price.Exposure can grow quickly in a one-way market.
MartingaleIncreases size after a loss to recover it with one win.A long losing streak can wipe out the account.
Grid and martingale systems often show a smooth, rising equity curve for months — until they don’t. A smooth curve on its own says nothing about the risk being carried.

What an EA does well

  • Executes the same rules every time, without emotion.
  • Monitors many pairs and timeframes at once.
  • Makes a strategy testable: rules in code can be backtested; vague “feel” cannot.

What an EA cannot do

  • Adapt to market conditions its rules were never designed for.
  • Guarantee anything about future results — markets change, and so do spreads, liquidity and volatility.
  • Remove the need for supervision. Platforms freeze, connections drop, brokers change conditions.

Next: what “AI” really means in an EA.

Risk reminder. Trading foreign exchange and CFDs on margin carries a high level of risk and may not be suitable for every investor. You can lose more than your initial deposit. Past or simulated performance of any trading system, including automated Expert Advisors, does not guarantee future results.