Expert Advisor Definition
In retail forex and CFD markets, an Expert Advisor (EA) is a rule-based algorithmic program designed specifically for the MetaTrader 4 (MT4) and MetaTrader 5 (MT5) platforms. Written in MetaQuotes Language (MQL4 or MQL5), an EA attaches to a chart, listens to incoming price quotes and terminal events, and programmatically analyzes markets, places pending or market orders, adjusts stop-losses, or alerts the trader.
Outside the MetaTrader ecosystem, similar tools are often called trading bots, forex robots, or algorithmic trading systems. Within MetaTrader itself, "Expert Advisor" is the formal platform category for programs stored in MQL4/Experts or MQL5/Experts that possess automated trade-execution rights.
How Expert Advisors Differ From Indicators and Scripts
Beginners frequently confuse the three program types inside MetaTrader's Navigator panel. Although all three are written in MQL4 or MQL5, their permissions and execution lifecycles are strictly separated:
| Feature | Expert Advisor (EA) | Custom Indicator | Script |
|---|---|---|---|
| Primary Purpose | Automated trading and active position management | Technical analysis, chart overlays, and oscillators | Single-action utility task (e.g., close all orders) |
| Can Place / Modify Orders? | Yes (when AutoTrading / Algo Trading is enabled) | No—indicators have zero trade-execution permissions | Yes, once per execution |
| Execution Lifecycle | Continuous event loop (OnTick, OnTimer) |
Continuous calculation (OnCalculate) per bar/tick |
Runs once (OnStart) and immediately unloads |
| Storage Folder | MQL4/Experts or MQL5/Experts |
MQL4/Indicators or MQL5/Indicators |
MQL4/Scripts or MQL5/Scripts |
| Charts Allowed | One EA per chart window | Multiple indicators per chart window | Runs once and exits |
How EA Trading Works Under the Hood
Every Expert Advisor follows an event-driven cycle while attached to an active chart inside a running MetaTrader terminal:
- Initialization (
OnInit): When you attach the EA and click OK, MetaTrader loads yourInputs, validates symbol/account permissions, allocates indicator handles (in MT5), and prepares risk variables. - Quote & Timer Evaluation (
OnTick/OnTimer): Each time the broker streams a bid/ask tick (or a timer interval fires), the EA checks filters such as spread, trading hours, indicator values, candlestick closes, and existing open orders matching its Magic Number. - Order Execution & Management: When entry criteria align, the EA transmits a trade instruction (
OrderSendin MQL4 orCTrade/OrderSendin MQL5) with defined volume, Stop Loss, and Take Profit. On subsequent ticks, it monitors trailing stops, breakeven levels, or exit signals. - Cleanup (
OnDeinit): When you remove the EA, change timeframe, or close MetaTrader, the terminal releases resources and records the shutdown reason in the Experts log.
Core Expert Advisor Strategy Archetypes
Not every EA trades aggressively or runs hands-free. Understanding which archetype a robot belongs to helps you judge whether its risk profile fits your account:
- Trend-Following EAs: Enter breakouts or pullbacks aligned with moving averages, channel structures, or higher-timeframe momentum. They typically accept lower win rates in exchange for larger winners during sustained trends, and suffer small whipsaws during sideways ranges.
- Mean-Reversion & Range EAs: Fade short-term overextensions back toward an average using oscillators like RSI or Bollinger Bands. They perform well in quiet sessions and must use hard stops to survive sudden trend breakouts.
- Scalping EAs: Target small intraday moves over minutes or seconds. Because spreads and commissions represent a large portion of each target, scalpers depend heavily on raw-spread ECN brokers and low-latency VPS hosting.
- Breakout & Session-Range EAs: Place pending stop orders or market entries around Asian range highs/lows, London opens, or New York cash opens (common on EURUSD, XAUUSD, and US30).
- Grid & Martingale Recovery EAs: Layer staggered orders at fixed or volatility-scaled intervals when price moves against the initial entry. While their balance curves look smooth for months, unhedged trend extensions can produce severe floating equity drawdown if strict basket stop-losses are missing.
- Trade Manager & Risk Utility EAs: Semi-automated assistants that do not predict entries at all—instead, you place manual trades and the EA handles fixed-percentage lot calculation, automatic breakeven, partial closes, or daily drawdown protection.
Realistic Advantages and Limitations of EA Trading
Automated trading excels at execution discipline: an EA never hesitates on a valid setup, never widens a Stop Loss out of fear, and can execute across London or Asian hours without human fatigue. It also lets you verify rule behavior objectively in MetaTrader's Strategy Tester before risking capital.
However, automation does not remove market risk or create guaranteed passive income. Common failure modes include:
- Market Regime Shifts: Volatility, central bank rate cycles, and session liquidity evolve; parameters tuned to last year's quiet range can struggle in this year's trending macro environment.
- Curve Fitting (Over-Optimization): Many commercial bots look pristine on historical backtests only because their parameters were sculpted to memorize past price noise.
- Execution Sensitivity: Live spreads, rollover widening, slippage, and broker stop levels can quickly turn tight backtest targets negative.
- Technical & Terminal Failures: Because EAs run on your terminal rather than the broker's server, computer reboots, internet drops, or misconfigured permissions interrupt live management unless hosted properly.
Used with realistic expectations, hard stop-losses, and thorough demo validation, Expert Advisors are powerful execution tools—whether running fully rules-based strategies or automating disciplined risk management around manual setups.