A step-by-step guide to setting up an Expert Advisor on MT5 for algorithmic traders.

If you run automated strategies, the quality of your broker's MT5 environment matters as much as the EA itself. Slow execution, platform downtime, or wide spreads will degrade any algo's performance before it even has a chance to prove itself.
This guide walks you through every step of setting up an Expert Advisor on MetaTrader 5 — from installing the file to running a backtest and going live. Whether you're deploying a scalping bot or a multi-session trend EA, the process is the same.
An Expert Advisor (EA) is an automated trading program that runs inside MetaTrader 5. It follows a defined set of rules to open, manage, and close trades without you manually clicking. EAs can range from simple moving average crossover systems to complex multi-symbol algos with dynamic position sizing.
MT5 supports EAs written in MQL5, the platform's native programming language. You can build your own, purchase one from the MQL5 marketplace, or use a third-party EA compiled as a .ex5 file.
Before touching any settings, make sure you have:
.ex5 file (compiled) or .mq5 file (source code)If you're trading with Spec Markets, MT5 is the native platform. You can open a demo or live account at specmarkets.com and connect in minutes. Both the Raw Zero and Pure Spread accounts support full EA and algo trading.
MT5 stores EA files in a specific data folder. Here's how to get your file into the right place:
.ex5 or .mq5 file into that folderYour EA will now appear in the Navigator panel under Expert Advisors. If you only have a .mq5 source file, open it in the MetaEditor (press F4), then compile it with F7 to generate the .ex5 file.
MT5 has a master switch for automated trading. If it's off, no EA will execute orders, regardless of its settings.
This is one of the most common reasons traders think their EA is broken when it's actually just switched off at the platform level.
You'll see a small smiley face icon in the top-right corner of the chart once the EA is attached. A happy face means it's active and allowed to trade. A sad face means algo trading is disabled or the EA has an error.
The settings window has three tabs: Common, Inputs, and Dependencies.
This is where your EA's parameters live — lot size, stop loss, take profit, indicator periods, session filters, and anything else the developer built in. Read the EA documentation carefully here.
A few general rules:
If your EA relies on external indicators or libraries, they'll be listed here. Make sure all dependencies are installed in the correct MT5 data folders.
Once you're satisfied, click OK.
Before risking real capital, run your EA through the MT5 Strategy Tester. Press Ctrl + R or go to View > Strategy Tester.
Key settings to configure:
| Setting | Recommendation |
|---|---|
| Expert Advisor | Select your EA from the dropdown |
| Symbol | Match the chart you plan to trade |
| Timeframe | Match your EA's intended timeframe |
| Modelling | Every Tick (most accurate) |
| Date range | Minimum 6–12 months of data |
| Deposit | Match your planned live account size |
| Leverage | Match your broker's offered leverage |
Run the test and review the Results and Graph tabs. Pay attention to:
Backtesting shows historical performance only. Past results do not predict future outcomes, and live market conditions will differ from historical data.
Run your EA on a demo account for at least two to four weeks in live market conditions before going live. Watch for:
When you're ready to go live, the broker's execution environment becomes critical. Your EA's logic means nothing if orders fill 300ms late or spreads spike unpredictably during entry signals.
Spec Markets' MT5 environment averages 0.028-second execution with 99.9% platform uptime across 15+ liquidity providers. For scalping EAs and high-frequency strategies, that consistency matters. The Raw Zero account (spreads from 0.0 pips, $3.50 commission per lot per side) is typically the better fit for EAs that open and close positions frequently. The Pure Spread account (spreads from 1.0 pips, no commission) works better for lower-frequency strategies where the per-trade commission would add up.
Open a live or demo account at specmarkets.com to test your EA in a real execution environment with a $50 minimum deposit.
What file format does MT5 use for Expert Advisors?
MT5 uses .ex5 files (compiled EAs). If you have a .mq5 source file, open it in MetaEditor and compile it to generate the .ex5 file before installing.
Can I run multiple EAs on MT5 at the same time?
Yes. You can attach a different EA to each chart window. Each EA runs independently, but they all share the same account balance, so make sure your total position sizing across all EAs stays within your risk limits.
Why is my EA not placing trades even though it's attached to a chart?
The most common causes are: the master Algo Trading button is off, "Allow Algo Trading" is unchecked in the EA's Common settings, the market is closed, or the EA's internal conditions haven't been met. Check the Journal tab for error messages.
How accurate is the MT5 Strategy Tester?
The "Every Tick" modelling mode is the most accurate option available. However, backtests use historical bid/ask data and cannot fully replicate live spread variations, slippage, or liquidity gaps. Always validate on demo before going live.
Does Spec Markets support all types of EAs, including scalping bots?
Yes. Spec Markets supports full EA and algo trading on MT5, including scalping strategies. The Raw Zero account's 0.0 pip spreads and 0.028-second execution make it well-suited for high-frequency EA strategies.
What is the best account type for running an EA on Spec Markets?
For EAs that trade frequently, the Raw Zero account (spreads from 0.0 pips, $3.50 commission per lot per side) generally produces lower total trading costs. For lower-frequency strategies, the Pure Spread account (spreads from 1.0 pips, no commission) may be more cost-effective.
Can I use a VPS to run my EA 24/5?
Yes, and it's recommended. A VPS keeps MT5 running continuously without depending on your local machine. MetaQuotes offers a built-in VPS option inside MT5, or you can use any third-party Windows VPS service.
Getting your EA set up correctly takes less than 30 minutes. The bigger investment is in testing it properly before you risk real capital. Follow the steps above, respect the demo phase, and choose a broker whose execution environment won't undercut your strategy's edge.
Learn more at specmarkets.com.
Risk disclaimer: Trading CFDs with leverage carries a high level of risk and may not be suitable for all traders. You can lose more than your initial deposit. Past performance of any EA or trading strategy does not guarantee future results. Ensure you fully understand the risks involved before trading live.