MetaTrader 4 Setup Guide

How to Install an Expert Advisor in MT4 (Complete 6-Step Tutorial)

Learning how to install an Expert Advisor in MT4 correctly prevents 90% of beginner bot headaches—from missing files in Program Files to blocked AutoTrading permissions and mismatched lot inputs. Follow this exact checklist to deploy any .ex4 or .mq4 trading robot cleanly.

Before You Start: Understanding MT4 File Extensions

MetaTrader 4 packages automated strategies and supporting files into four distinct folder destinations. Dropping an indicator into the Experts folder—or placing a .set preset in the root directory—is the most common reason an EA fails to initialize or refuses to open trades. Before opening your terminal, match every file in your archive to its proper MQL4 subdirectory:

.ex4 / .mq4 → MQL4/Experts

An .ex4 file is a compiled binary ready for MT4 execution. An .mq4 file is human-readable MQL4 source code that must be compiled in MetaEditor into an .ex4 before running.

.set → MQL4/Presets

Preset files store curated parameter sets (timeframe filters, trading hours, trailing stops, and lot rules) tailored for specific pairs like EUR/USD or XAU/USD.

Custom Indicators → MQL4/Indicators

Many robots call external custom indicators via iCustom(). If a bundle includes separate indicator files, browse our MT4 indicators library and always keep indicator binaries inside MQL4/Indicators.

.dll / .mqh → MQL4/Libraries or Include

Dynamic-link libraries (.dll) go into MQL4/Libraries, and header files (.mqh) belong in MQL4/Include. Only enable DLL imports for software from trusted publishers.

Step-by-Step Installation Workflow

6 Steps to Install & Activate an MT4 Expert Advisor

  1. Step 1: Download and Unpack the Expert Advisor Archive

    Download your Expert Advisor package to a clean folder on your desktop or VPS and extract any .zip or .rar archive first. Never try to drag a file directly from inside a compressed archive into MetaTrader 4. Read any included setup documentation to note the recommended symbol (for example, EUR/USD or XAU/USD), chart timeframe (M15, H1, etc.), and minimum account balance or leverage requirements.

  2. Step 2: Open the Correct MT4 Data Folder

    Launch your broker's MetaTrader 4 desktop terminal and log in to a demo account first. In the top menu bar, click File → Open Data Folder (shortcut: Ctrl+Shift+D). Always use this built-in command rather than browsing C:\Program Files (x86)\ directly. Modern Windows builds isolate user terminal data inside AppData\Roaming\MetaQuotes\Terminal\<HASH>\, so pasting files into Program Files leaves them invisible inside Navigator unless you run MT4 in portable mode.

  3. Step 3: Copy Files into MQL4/Experts (and Presets/Indicators)

    Inside the Data Folder window, double-click MQL4, then open Experts and paste your .ex4 or .mq4 robot file. If your download contains .set files, place them in MQL4\Presets. If it includes helper indicators, paste them in MQL4\Indicators. Do not rename helper indicator files, because the EA references their exact file names inside iCustom calls.

  4. Step 4: Refresh Navigator or Compile .mq4 in MetaEditor

    Return to MT4 and press Ctrl+N to reveal the Navigator panel. Expand Expert Advisors, right-click anywhere inside that tree, and choose Refresh (or restart MT4 completely). If you only copied a .mq4 source file and its icon looks grayed out, press F4 to open MetaEditor, open the .mq4 file under Experts, and press Compile (F7). Check the bottom Errors tab to verify 0 errors before returning to MT4.

  5. Step 5: Enable AutoTrading, Attach to Chart & Set Risk Inputs

    Before attaching the robot, verify your master terminal settings under Tools → Options → Expert Advisors (or Ctrl+O). Tick Allow automated trading and review whether you want the terminal to disable trading on account or profile switches (usually recommended for safety). Then click the main AutoTrading button on the top toolbar so its circle turns green.

    Next, open a fresh chart for the exact symbol and timeframe your strategy specifies (watch out for broker suffixes such as EURUSD.r or XAUUSDm). Drag the EA from Navigator onto the chart. In the popup dialog:

    • Common tab: Check Allow live trading (and Allow DLL imports only if the EA documentation explicitly requires a verified local library).
    • Inputs tab: Click Load to import your .set preset, assign a unique MagicNumber for every chart running simultaneously, and calculate your lot size using our Forex Position Size Calculator before entering FixedLot or RiskPercent.
  6. Step 6: Verify the Smiley Face & Audit Terminal Logs

    Click OK and inspect the upper-right corner of the chart. You must see the EA's name followed by a smiley face. Next, press Ctrl+T to open the Terminal pane and examine both the Experts and Journal tabs. A clean install logs initialized without red error icons, missing indicator alerts, or WebRequest URL blocks. Leave the system running on a demo account for at least one to two full weeks to observe live spreads, news slippage, and margin behavior before considering any live capital.

Diagnostic Reference

MT4 Expert Advisor Troubleshooting Table

If your robot attaches to a chart but stays silent—or logs errors inside the Terminal pane—use this diagnostic matrix to pinpoint the exact blocker in seconds:

Symptom / Error CodeRoot CauseExact Fix
Sad / Frowning face :(Global AutoTrading or per-chart live trading is unchecked.Click toolbar AutoTrading (green) and press F7 → Common → tick Allow live trading.
EA grayed out in NavigatorUncompiled .mq4 or build mismatch lacking .ex4.Open in MetaEditor (F4), hit Compile (F7), and resolve compiler errors.
EA missing after copyFiles pasted into Program Files instead of active Data Folder.Use File → Open Data Folder → MQL4 → Experts, copy again, and Refresh Navigator.
Error 133 (Trade disabled)Wrong broker suffix symbol (e.g., trading EURUSD instead of EURUSD.pro) or investor password login.Log in with master trading password and attach EA to the active tradeable Market Watch symbol.
Error 131 (Invalid trade volume)Lot size violates broker min/max lot or 0.01 step size.Check Market Watch → Specification and set a valid floored lot using the Position Size Calculator.
Error 4060 / WebRequest failedEA news filter or license server URL is not whitelisted.Go to Tools → Options → Expert Advisors, enable Allow WebRequest for listed URL, and add the verified host.
Cannot open file / OnInit failedMissing custom indicator in MQL4/Indicators or blocked DLL import.Verify helper indicator names in MQL4/Indicators and inspect the Experts log line.
Production Best Practices

VPS Hosting, Magic Numbers & Spread Checks

Once an Expert Advisor compiles cleanly and displays a smiling face, three operational practices keep live execution aligned with expectations:

  • Assign unique Magic Numbers per chart: If you run the same robot across EUR/USD and GBP/USD—or two strategies on one pair—change the MagicNumber parameter on every chart so one EA never closes or modifies trades opened by another instance.
  • Set a realistic MaxSpread filter & equity stop: During the 17:00 EST New York rollover hour or major central-bank releases, spreads on FX and XAU/USD can spike sharply. Configure your EA's maximum spread threshold and drawdown equity stop appropriately—or use an automated backtest in MT5's Strategy Tester to evaluate how variable spreads affect expectancy.
  • Keep MT4 running on a dedicated VPS: Trailing stops, breakeven triggers, and basket exit scripts live inside your local terminal rather than on the broker's server. Closing your laptop halts every EA calculation immediately. Configure a low-latency Forex VPS for MT4 and verify uptime on a demo account first.

Explore MT4 Robots, Indicators & Related Guides

Helpful answers

Frequently Asked Questions

Why does my MT4 Expert Advisor show a sad or frowning face instead of a smiley face?

A frowning face in the top-right corner of an MT4 chart means the EA is attached, but automated order execution is disabled. Turn on the master AutoTrading button in the MT4 toolbar (or press Ctrl+E), then press F7 to open EA Properties -> Common and check Allow live trading.

Should I install the .ex4 file, the .mq4 file, or both in MQL4/Experts?

MetaTrader 4 executes the compiled .ex4 file directly. If your download includes both .mq4 and .ex4, placing the .ex4 file in MQL4/Experts is enough to run the robot, while keeping the .mq4 file lets you inspect or customize the code inside MetaEditor and recompile with F7.

Why is my newly copied Expert Advisor grayed out in the MT4 Navigator?

A gray icon in the Navigator means MT4 only sees an uncompiled .mq4 file without a matching .ex4 binary, or MetaEditor failed to compile it due to syntax or build errors. Double-click the file in MetaEditor (F4) and press Compile (F7) to generate the .ex4 file and review any error lines.

Where do .set preset files and custom helper indicators go in MT4?

Copy .set parameter files into MQL4/Presets so you can load them via the Load button inside the EA's Inputs tab. Copy any custom indicators required by the robot into MQL4/Indicators—never into MQL4/Experts—because the EA calls them internally via iCustom.

Can I close my computer after installing an Expert Advisor on MetaTrader 4?

No. An MT4 Expert Advisor only runs while your desktop MetaTrader 4 terminal stays open, connected to your broker server, and unlocked. For 24/5 automated trading without home power or Wi-Fi interruptions, run MT4 inside a low-latency Windows Forex VPS.