P
PipsGrowth
Automation

How to Install an Expert Advisor on MT5: Complete Step-by-Step Guide

Learn how to install an Expert Advisor on MetaTrader 5 in 5 simple steps. Download, copy, compile, attach, and enable your EA for automated forex trading.

PG
Pips Growth Team
2026-07-01
9 min

How to Install an Expert Advisor on MT5: Complete Step-by-Step Guide

Installing an Expert Advisor on MT5 is straightforward once you know the steps. Whether you downloaded a free .mq5 source file, purchased a commercial EA, or built your own in MetaEditor, this guide walks you through the complete installation process — from file placement to live trading.

Prerequisites

Before installing an EA, make sure you have:

  1. MetaTrader 5 installed — Download it from your broker's website for optimal server configuration
  2. An active MT5 account — Demo or real account with login credentials
  3. The EA file — Either a .mq5 (source code) or .ex5 (compiled) file
  4. Algo Trading enabled — We'll cover this in step 5

New to MT5? Read our MetaTrader 5 Complete Guide first to familiarize yourself with the platform.


Step 1: Open the MT5 Data Folder

The most common mistake beginners make is placing the EA file in the wrong directory. MT5 has a specific folder structure, and Expert Advisors must go in the MQL5/Experts folder.

  1. Open MetaTrader 5
  2. Click File in the top menu bar
  3. Select Open Data Folder from the dropdown
  4. A Windows Explorer / Finder window opens showing the MT5 data directory

Alternatively, press Ctrl+Shift+D to open the data folder directly.

The folder structure looks like this:

MT5 Data Folder/
├── MQL5/
│   ├── Experts/        ← Your EA goes here
│   ├── Indicators/
│   ├── Scripts/
│   ├── Include/
│   └── Libraries/
├── logs/
├── config/
└── ...

Step 2: Copy the EA File to the Experts Folder

  1. Navigate to MQL5/Experts/ inside the data folder
  2. Copy your .mq5 or .ex5 file into this folder
  3. If you have sub-folders organized by strategy type (e.g., Experts/Scalping/), you can place the file there — MT5 will find it

Important distinctions:

  • .mq5 files are source code — they need to be compiled before they can run
  • .ex5 files are already compiled — they can run immediately without compilation
  • If you have a .mq5 file, proceed to Step 3
  • If you have a .ex5 file, skip to Step 4

Organizing Multiple EAs

If you plan to run multiple EAs, create sub-folders inside Experts/:

MQL5/Experts/
├── Scalping/
│   ├── my_scalper.mq5
├── Grid/
│   ├── grid_bot.mq5
├── Trend/
│   ├── trend_follower.mq5

MT5 automatically scans all sub-folders inside Experts/.


Step 3: Compile the EA in MetaEditor (for .mq5 files only)

If your EA is a .mq5 source file, it must be compiled into a .ex5 before MT5 can run it.

  1. In MT5, press F4 to open MetaEditor
  2. In MetaEditor, navigate to your EA file in the Navigator panel (left side)
  3. Double-click the .mq5 file to open it
  4. Press F7 or click Compile in the toolbar
  5. Check the Errors tab at the bottom:
    • 0 errors, 0 warnings → compilation successful
    • Any errors → fix them before proceeding

Common Compilation Errors

Error Meaning Fix
'CTrade' — undefined Missing standard library include Add #include <Trade\Trade.mqh> at the top
undeclared identifier Variable used without declaration Declare the variable before using it
cannot convert Type mismatch Cast explicitly: (int), (double), (string)
expression has no effect Statement doesn't do anything Check for missing = in assignments

If you downloaded an EA that won't compile, contact the developer or check if you're missing dependency files (.mqh include files should go in MQL5/Include/).


Step 4: Refresh the Navigator in MT5

After copying or compiling the EA file, MT5 needs to refresh its navigator to detect the new file.

  1. Return to MetaTrader 5
  2. Open the Navigator panel (press Ctrl+N if it's not visible)
  3. Expand the Expert Advisors section
  4. Right-click on "Expert Advisors" in the Navigator
  5. Click Refresh

Your EA should now appear in the list. If it doesn't:

  • Verify the file is in MQL5/Experts/ (not MQL5/Indicators/ or another folder)
  • Check that the file compiled successfully (look for the .ex5 file in the same folder)
  • Restart MT5 if refresh doesn't work

Step 5: Attach the EA to a Chart and Enable Algo Trading

Attach the EA

  1. In the Navigator panel, find your EA under Expert Advisors
  2. Drag and drop the EA onto a chart of the symbol you want to trade
  3. The EA settings dialog appears

Configure EA Parameters

The Inputs tab shows all customizable parameters for your EA:

  • LotSize — Position size for each trade
  • StopLoss — Stop loss in points (remember: 1 pip = 10 points on 5-digit brokers)
  • TakeProfit — Take profit in points
  • MagicNumber — Unique identifier for this EA's trades (use different numbers for each EA)
  • Any strategy-specific parameters (SMA periods, grid spacing, etc.)

Set these carefully — they determine your EA's behavior and risk.

Enable Algo Trading

  1. In the settings dialog, check the Allow Algo Trading checkbox
  2. Go to the Common tab and ensure Allow Automated Trading is checked
  3. Click OK
  4. In the MT5 toolbar, click the Algo Trading button (it should turn green)

If the button is gray, algo trading is disabled globally. Enable it by clicking the button or pressing Ctrl+E.

Verify the EA is Running

When your EA is active:

  • A smiley face icon appears in the top-right corner of the chart
  • The Experts tab in the Toolbox panel (bottom) shows EA log messages
  • The Journal tab shows order execution logs

If you see a frown face or an X icon, check the Experts tab for error messages.


Post-Installation: Testing Your EA

Start with a Demo Account

Never run an untested EA on a real money account. Always:

  1. Open a demo account with your broker
  2. Attach the EA to the demo chart
  3. Monitor performance for 2-4 weeks minimum
  4. Check the Experts log for errors or unexpected behavior
  5. Only switch to a real account after consistent demo performance

Monitor EA Logs

The Experts tab in MT5's Toolbox shows all EA activity:

  • Order opens and closes
  • Error messages
  • Strategy signals
  • Parameter changes

Review these logs daily during testing. If you see repeated errors like "invalid stops" or "not enough money," your EA parameters need adjustment.

Use the Strategy Tester First

Before even running on demo, backtest your EA in MT5's Strategy Tester:

  1. Press Ctrl+R to open Strategy Tester
  2. Select your EA
  3. Choose symbol, timeframe, and date range
  4. Click Start

For a complete walkthrough, see our MT5 EA Backtesting Guide.


Troubleshooting Common Installation Issues

"EA doesn't appear in Navigator after refresh"

  • Verify the .ex5 file exists in MQL5/Experts/ (check if compilation succeeded)
  • Try restarting MT5 completely
  • Check for file permission issues (Windows may block files from external sources)

"Algo Trading button is gray and won't enable"

  • Go to Tools → Options → Expert Advisors
  • Check Allow Automated Trading
  • Ensure your account allows EA trading (some broker account types restrict this)

"EA attached but no trades are opening"

  • Check the Experts log for error messages
  • Verify the market is open for the symbol you're trading
  • Check if your EA has position-size or balance guards that prevent trading
  • Ensure you have sufficient margin for the configured lot size

"EA works on one chart but not another"

  • Some EAs are coded for specific symbols or timeframes
  • Check the EA's input parameters for symbol/timeframe restrictions
  • Verify the chart symbol matches the EA's intended trading instrument

"Smiley face shows but EA is not trading"

  • The EA may be waiting for specific market conditions (e.g., a crossover that hasn't occurred)
  • Check if the EA only trades on new bar formation (it may be waiting for the next candle)
  • Look at the Experts log — it may show "waiting for signal" or similar messages

Best Practices for EA Management

Use Unique Magic Numbers

Every EA you run should have a different magic number. This prevents EAs from interfering with each other's positions and allows you to track which EA opened which trade.

Don't Run Too Many EAs on One Account

Running 10+ EAs simultaneously can:

  • Overload MT5's processing
  • Create margin conflicts
  • Make it impossible to identify which EA is losing money

Stick to 3-5 EAs per account maximum. Use separate accounts for different strategies.

Keep Your EA Updated

Check for EA updates regularly. Developers release updates to fix bugs, improve performance, and adapt to changing market conditions. Always test updates on demo before applying to live trading.

Use a VPS for 24/5 Uptime

Your EA can't trade if your computer is off. A VPS ensures your EA runs continuously. Many brokers offer free VPS for qualifying accounts. See our Best Broker for MT5 EAs guide for VPS recommendations.


Frequently Asked Questions

Can I install an EA on MT5 mobile app?

No. MT5 mobile apps (iOS and Android) do not support Expert Advisors. EAs can only run on the desktop version of MT5 (Windows) or through a VPS. However, you can monitor your EA's performance from the mobile app.

Do I need to keep the chart window open for the EA to work?

The chart must be open in MT5, but it doesn't need to be the active/visible tab. If you close the chart, the EA stops running. You can minimize the chart or switch to another tab, but don't close it.

Can I run the same EA on multiple charts simultaneously?

Yes, but each instance must have a different magic number. Without unique magic numbers, the EAs will conflict — one EA might close another's positions or miscount open trades.

How do I remove an EA from a chart?

Right-click on the chart, select Expert Advisors → Remove. Alternatively, press Ctrl+I to open the indicators/EA list and remove it from there.

Is it safe to download EAs from the internet?

Only download EAs from reputable sources. Malicious EAs can steal your account credentials or execute unauthorized trades. Always review the source code (.mq5) before compiling. If you only have the .ex5 file, scan it with antivirus software and test on a demo account first.


Disclaimer: Automated trading carries significant risk. Expert Advisors can lose money rapidly if market conditions change or if parameters are set incorrectly. Always test on a demo account and never risk more than you can afford to lose.

Affiliate Disclosure: This page contains affiliate links. We may earn a commission when you click on certain links or sign up with brokers featured on this site, at no additional cost to you. Our reviews and recommendations are based on thorough research and remain unbiased.Learn more

Risk Warning: Trading forex and CFDs involves significant risk of loss. Past performance is not indicative of future results. CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. Ensure you understand the risks before trading. This content is for educational purposes only and does not constitute financial advice.

Written by

Pips Growth Team

Trading Education & Research Team

The Pips Growth Team is a group of experienced traders, financial analysts, and trading educators dedicated to providing accurate, actionable forex education. Our team combines decades of hands-on market experience with deep technical knowledge to create comprehensive guides, honest broker reviews, and proven trading strategies. Every article is thoroughly researched, fact-checked, and reviewed by multiple team members to ensure the highest quality and accuracy.

15+ Years Experience53+ Articles Published
Forex & CFD TradingTechnical AnalysisRisk ManagementBroker Reviews & Evaluation
View Full Profile
Share

Get Trading Tips

How to Install an Expert Advisor on MT5: Complete Step-by-Step Guide | PipsGrowth