Skip to content
GuidesUpdated · Published 2026-10-08Forex Guide

Expert Advisors (EA) Explained: How MT4/MT5 Trading Robots Work

What an Expert Advisor is, how EAs run in MetaTrader 4 and 5, where to get them (Market, Code Base, Freelance), how to backtest, and why many EA sellers.

7 min read

Reviewed by · Lead Prop Firm & Quantitative Risk Analyst

Reviewed using our forex & CFD broker review methodology

Vantage Markets logo
Vantage Markets 4.1/5 · ASIC + FCA Tier-1 & Global
Verified 2026 Specs
Checked
150% + 25% Deposit Credit (Offshore Entities Only — Not FCA/ASIC) Valid through Dec 31, 2026 (VFSC Entity)
4.2/5
Trustpilot
FCA + ASIC
Tier-1 Entities
$50
Min. deposit
1,000+
Instruments
Expert Advisors (EA) Explained: How MT4/MT5 Trading Robots Work — verified 2026 research cover
Vantage Markets logo
Vantage Markets 4.1/5
Valid through Dec 31, 2026 (VFSC Entity)

An Expert Advisor (EA) is a program that trades for you inside MetaTrader. It reads prices, applies fixed rules and opens, changes or closes trades on its own. EAs are written in MQL4 (for MT4) or MQL5 (for MT5). They only run on the desktop terminal (or a VPS), not on the mobile or web versions. You can get them from the MetaTrader Market (paid or rented, with a free trial), the free MQL5 Code Base, or MQL5 Freelance for custom work. You can also build one with the MQL5 Wizard or MetaEditor. Test every EA in the Strategy Tester and on a demo account before using real money.

How to Install and Run an EA in MT4 or MT5

An Expert Advisor consists of source code (.mq4 for MT4 or .mq5 for MT5) compiled into an executable file (.ex4 or .ex5). Because MQL4 and MQL5 use different order-handling functions, an .ex4 file cannot run inside MetaTrader 5, and an .ex5 file cannot run inside MetaTrader 4. To install and activate an EA on your desktop terminal:

  1. Click File → Open Data Folder in the top menu bar, open the MQL4 (or MQL5) folder, open Experts, and paste your .ex4 or .ex5 file inside. (If the EA requires custom .dll libraries or .mqh include files, place those in the Libraries or Include subfolders.)
  2. Right-click Expert Advisors in the Navigator panel (Ctrl+N) and click Refresh (or restart MetaTrader).
  3. Open the exact chart symbol and timeframe the EA was designed for (for example, EURUSD, M15), then drag the EA from the Navigator onto the chart.
  4. In the pop-up properties window, open the Common tab and tick Allow live trading (MT4) or Allow Algo Trading (MT5). In the Inputs tab, configure your Magic Number (a unique integer ID so the EA only manages its own orders), fixed lot size or risk percentage, maximum spread filter, and stop-loss distance.
  5. Click the global AutoTrading (MT4) or Algo Trading (MT5) button in the top toolbar so it turns green. Verify that the top-right corner of the chart displays a smiling face (MT4) or a blue/green graduation cap (MT5). If the face is frowning, open Tools → Options → Expert Advisors and enable automated trading.
  6. Keep the desktop terminal running continuously. If your PC sleeps, loses Wi-Fi, or reboots for a Windows update, your EA stops managing open positions—which is why systematic traders run EAs on a 24/7 Virtual Private Server (VPS).
HNL Growth logo
HNL Growth Research · Independent Quantitative Desk
✓ PRIMARY-SOURCE AUDITED · 2026
EXHIBIT 04 // HNL TERMINAL & ORDER-ROUTING TOPOLOGY BROKER PLATFORM INFRASTRUCTURE · MT5 · MT4 · WEB & MOBILE

Trading Terminal Suite: Broker Desktop, Web, Mobile & High-Frequency Server Topology

Comprehensive evaluation of Broker client terminals, automated EA support, and server routing stability.

ACTIVE INFRASTRUCTURE: MULTI-ASSET DEPTH OF MARKET (DOM) & FAST EXECUTION
Flagship Multi-Asset Terminal

MetaTrader 5 (MT5)

WindowsmacOSiOSAndroidWeb
  • 21 Timeframes & 38 Technical Indicators
  • Level II Depth of Market (DOM) with tick volume
  • MQL5 Multi-Threaded EA Strategy Tester
  • 6 Pending Order Types & 1-Click Execution
Classic Algorithmic Engine

MetaTrader 4 (MT4)

WindowsmacOSiOSAndroidWeb
  • 9 Timeframes & 30 Standard Technical Indicators
  • MQL4 Expert Advisor automated trading
  • Independent hedging order tickets
  • Lightweight desktop footprint & high stability
On-The-Go Trading Hub

Mobile App & WebTrader

iOS (App Store)Android (Google Play)Web Browser
  • Zero-install HTML5 browser workspace
  • Biometric login & push notifications
  • Instant deposit & withdrawal cashier integration
  • Live price alerts and watchlists
Financial Server Hub
Equinix Financial Data Centers (London LD4 / New York NY4)
Order Execution SLA
< 35ms Average Fill Latency (Direct Interbank Liquidity)
Free Sponsored VPS
Co-located VPS available for algorithmic traders
Key Takeaway: Ensure your trading terminal is connected to the closest geographical server cluster provided by Broker to minimize slippage during high-volatility news events.

Where EAs Come From: Official vs High-Risk Channels

Source Typical Cost Code Access & Safety Notes
MetaTrader Market (built into terminal) Buy ($30–$1,000+) or monthly rental Compiled .ex4/.ex5 only; MetaQuotes provides a free Strategy Tester demo download before purchase
MQL5 Code Base Free Full open-source .mq4/.mq5 code that you can inspect, audit, and edit in MetaEditor (F4)
MQL5 Freelance Custom quote ($50–$500+) Escrow-protected marketplace where vetted MQL developers code your exact strategy specification
MQL5 Wizard / MetaEditor Free Built-in IDE (F4 in terminal) to generate or write your own rule-based EAs and scripts
Telegram / Social Media "Robot" Sellers $100–$2,000+ or broker IB lock-in Highest risk: frequently repackaged free martingale grid scripts with curve-fitted backtest screenshots

Strategy Tester Backtesting Math & Latency Impact

Before running any Expert Advisor on a live account, test it thoroughly in the MetaTrader Strategy Tester (Ctrl+R). On MT5, select Every tick based on real ticks rather than 1 minute OHLC or Open prices only—especially if the EA scalps or uses tight trailing stops.

Worked Example: How Spread, Commission, and Slippage Change EA Expectancy

Suppose you test a mean-reversion scalping EA on EUR/USD M5 over 500 trades at 1.00 standard lot ($10/pip) per trade:

  • Unrealistic Zero-Cost Backtest (fixed 0.5-pip spread, 0 commission, 0 slippage): The EA records a 62% win rate with an average win of +8.0 pips ($80) and an average loss of -10.0 pips (-$100).
    Gross Expectancy per Trade = (0.62 × $80) - (0.38 × $100) = $49.60 - $38.00 = +$11.60 per trade
    Across 500 trades, the backtest curve shows +$5,800 net profit.
  • Real-World Live Execution (0.3-pip raw spread + $6.00 round-turn ECN commission + 0.4-pip average latency slippage = $13.00 total friction per lot): Adding just 0.7 pips of extra friction ($7.00) plus $6.00 commission reduces every trade by $7.00 to $8.00 compared to the idealized test, cutting net expectancy to +$3.60 per trade (or flipping a tighter scalper into a net loser).
  • VPS Latency Advantage: Running your terminal on a home PC 150–250 ms away from your broker's Equinix LD4 (London) or NY4 (New York) trade server increases market-order fill delay during volatile news ticks—see our Economic Calendar. Hosting the EA on a VPS in the same city reduces ping to 1–5 ms, cutting execution slippage. You can model how execution drag and losing streaks affect your equity using our Drawdown Calculator and Profit Calculator.

Always run out-of-sample validation: if you optimize an EA's moving-average and RSI inputs on historical data from 2022–2024, freeze the parameters and test them untouched on 2025–2026 data, followed by at least 4 to 8 weeks of forward-testing on a demo account. Our EA trading strategy guide covers walk-forward testing in more depth.

Broker & Prop Firm Rules for EAs

Most retail forex brokers welcome Expert Advisors, but you should always check three execution parameters before deploying a bot:

  1. Stops Level (SYMBOL_TRADE_STOPS_LEVEL): Right-click your pair in Market Watch → Specification and check Stops level. A value of 0 allows EAs to place tight stop-losses and pending orders right next to the current bid/ask price.
  2. Prohibited Arbitrage & HFT: Even EA-friendly brokers prohibit latency arbitrage, tick-data stuffing, or exploiting stale off-market price feeds. Tickmill, Vantage, and VT Markets state that legitimate EAs and scalping are permitted on their core STP and Raw ECN accounts.
  3. Prop Firm EA Restrictions: Proprietary trading firms often enforce stricter EA rules than retail brokers—including bans on high-frequency tick scalpers, news-straddle bots within 2–5 minutes of high-impact releases, and shared third-party commercial EAs that trigger "group copy trading" flags across multiple traders unless each user runs a unique set file and Magic Number.

"Forex Robot" Red Flags to Avoid

  • Smooth 45-degree equity curves with 95%+ win rates: Almost always indicate a Martingale or Grid EA that refuses to take a stop-loss and doubles lot size (0.01 → 0.02 → 0.04 → 0.08 → 0.16...) as price moves against it until a single unretraced trend liquidates the entire account (see martingale strategy).
  • Backtest screenshots without a live Investor Password or verified third-party tracker: Any programmer can code an EA to read future dates in historical data and produce a 10,000% backtest.
  • Mandatory unregulated broker sign-ups: Avoid "free" robot sellers who force you to deposit $500+ with an obscure offshore broker to unlock the EA license.

Related: What is MetaTrader? · MT4 vs MT5 · Forex signals

Official sources: MetaTrader 5 user guide (metatrader5.com) · MetaTrader 4 user guide (metatrader4.com).

Expert Advisors: Your Questions Answered

Do Forex Expert Advisors actually make money?

Rule-based Expert Advisors can be profitable when their underlying logic matches the current market regime—for example, a breakout EA during high-volatility directional trends or a mean-reversion EA during quiet Asian sessions. However, no EA works forever across every market condition without risk controls, and most low-cost commercial "robots" sold on social media fail in live trading due to curve-fitting or hidden martingale risk.

Can I run an Expert Advisor on the MT4 or MT5 mobile app?

No. Neither the iOS nor the Android version of MetaTrader 4 or MetaTrader 5 includes the MQL runtime engine required to execute Expert Advisors. To run an EA 24 hours a day while monitoring your trades from your phone, install the EA on a Windows desktop terminal or a cloud Forex VPS and sign in to the same trading account on your mobile app.

Is an Expert Advisor the same as a forex trading signal?

No. An Expert Advisor is a software script installed directly inside your own MetaTrader desktop terminal that analyzes live price ticks and executes orders automatically according to coded rules. A trading signal (or copy-trading feed) mirrors trades placed by another human trader or external account onto your account over the internet.

Why is my EA showing a frowning face in MetaTrader 4?

A frowning face in the top-right corner of an MT4 chart means the Expert Advisor is loaded onto the chart but is blocked from placing live orders. Click the AutoTrading button in the top toolbar so its icon turns green, then press F7 on the chart, open the Common tab, and tick the Allow live trading checkbox.

Can I use an MT4 Expert Advisor (.ex4) in MetaTrader 5?

No. MetaTrader 4 Expert Advisors are written in MQL4 (.mq4 / .ex4), whereas MetaTrader 5 Expert Advisors are written in MQL5 (.mq5 / .ex5). Because the two platforms use different order-execution architectures, an MT4 robot must be rewritten and recompiled in MetaEditor 5 before it can run on an MT5 account.

What is a Magic Number in an Expert Advisor?

A Magic Number is a unique integer identifier (for example, 104201) that an Expert Advisor attaches to every market or pending order it opens. When you run multiple EAs on the same trading account—or mix manual trades with automated trades—the Magic Number ensures each EA only modifies, trails, or closes the specific orders it created.

Sources checked 2026-10-01: metatrader5.com "Automated Trading" (Market, Code Base, Freelance, MQL5 Wizard, Strategy Tester, VPS); broker account pages for Tickmill, Vantage, VT Markets.

Sources & verification

Last checked
Written by
HNL Growth Team
Reviewed by
Hà Ngọc Lộc
Length
7 min read

Rules, prices and payout terms on this page were checked against the official websites, help-centre articles and published terms of the firms mentioned, on the date above. Prop firms and brokers change conditions often — confirm the current version on the official site before you buy or deposit. Read our broker review methodology and affiliate disclosure.

Official sources & documentation verified

  • MetaTrader 5 user guide(metatrader5.com)
  • MetaTrader 4 user guide(metatrader4.com)

Explore Related Hubs & Free Trading Tools

Vantage Markets logo
Vantage Markets 4.1/5 · ASIC + FCA Tier-1 & Global
Verified Offer 150% + 25% Deposit Credit (Offshore Entities Only — Not FCA/ASIC)

Ready to Trade with Vantage Markets?

Vantage Markets is a multi-regulated forex & CFD broker (FCA, ASIC, FSCA, CIMA, VFSC) with Raw ECN pricing ($3/side = $6/lot RT), Pro ECN ($1.50/side = $3/lot RT), no deposit/withdrawal fees, and full MT4/MT5/TradingView support. Check which legal entity onboards your country before funding.

FCA (UK, FRN 590299) + ASIC (AU, AFSL 428901) Tier-1 entities
$50 minimum deposit (Standard STP / Raw ECN / Cent)
Raw ECN spreads from 0.0 pips + $3/side ($6/lot RT) · Pro ECN $1.50/side ($3/lot RT)
MT4, MT5, TradingView & Vantage App
Confirm your onboarding entity & leverage cap before funding

Risk disclaimer: Vantage Markets is a live, multi-entity broker — trading forex and CFDs is done with real capital under normal market risk (this is not a simulated prop-firm evaluation). Deposit credit promotions (150% + 25% bonus) and high leverage (above 1:30) are offered exclusively under offshore entities (VFSC/CIMA) and are prohibited for retail clients under FCA (UK) and ASIC (Australia) regulations. CFDs and leveraged forex products are complex instruments and carry a high risk of losing money rapidly due to leverage; most retail investor accounts lose money trading these products. Affiliate disclosure: HNL Growth earns a commission when you open a Vantage Markets account through links on this page.