You have an Expert Advisor (EA) — whether one you programmed, downloaded from our free robot, or bought — and now you need to get it running on MetaTrader 5. This tutorial covers the complete process, from scratch, with attention to the details that trip up beginners (the famous "I installed it but the robot doesn't trade"). We'll go from the file to the backtest to deployment.
Prerequisite: you need MT5 installed (downloaded from your broker, not a generic site — you need the right broker's server) and the EA file, which has the extension .ex5 (compiled) or .mq5 (source code). If you haven't chosen a broker yet, see our reviews of brokers with MT5.
01Step 1: Put the EA in the right folder
MT5 only sees robots that are in the correct data folder. The safest path to reach it:
In MT5, go to File → Open Data Folder. This opens the file explorer exactly at the folder MT5 uses — it avoids the common mistake of putting the EA in the wrong installation folder.
In the folder that opened, go into MQL5 → Experts and paste your robot's file there (.ex5 or .mq5). If it's an indicator, it goes in Indicators; if a script, in Scripts.
Go back to MT5. In the Navigator panel (Ctrl+N if it's not visible), right-click on "Expert Advisors" and choose Refresh. Your robot should appear in the list.
02Step 2: Enable Auto Trading
This is the step that most often produces "my robot does nothing." MT5 has a master automated-trading button that must be green/on. Without it, the EA loads on the chart but sends no orders.
The button is in the top toolbar, called "Algo Trading" (or "Auto Trading" in older versions). Green = on. Red = off. Click to toggle.
Two permission levels: besides the global button, each EA has its own permission. When you drag the robot onto the chart (next step), in the "Common" tab check "Allow Algo Trading". Both need to be active.
03Step 3: Drag the EA onto the chart
Open the chart of the asset you want to trade (e.g. ES, EURUSD). In the Navigator, drag the EA onto the chart (or double-click it). A configuration window opens.
Check "Allow Algo Trading". The other options (allow DLL imports, etc.) are usually left unchecked for safety, unless the robot requires them.
Here are the robot's variables (lot size, stop, take, the averages' period, etc.). Configure them according to the strategy. Always start with the minimum lot.
Click OK. If all went well, a smiley face 🙂 appears in the top-right corner of the chart — it means the EA is active. If you see a 🙁 or ✗, auto trading isn't enabled at some level.
The green light of success: the EA icon in the corner of the chart smiling + the robot's name next to it. If you see that, the robot is monitoring the market and will trade according to its rules.
04Step 4: Backtest in the Strategy Tester (BEFORE trading)
This step is non-negotiable. Never run an EA on a live account without first testing it on history. MT5 has a built-in simulator — the Strategy Tester — that runs your robot over years of past data in seconds.
Open it with View → Strategy Tester (or Ctrl+R). Configure:
- Expert: select your robot
- Symbol: the asset (e.g. ES, EURUSD)
- Period: the timeframe (M5, M15, H1...)
- Date range: use at least 2-3 years, covering uptrends, downtrends and ranges
- Modeling: "Every tick based on real ticks" is the most accurate (and slowest)
Read the drawdown, not just the profit: a curve that climbs nicely but with a 40% drawdown is a time bomb — it means that at some point you'd have lost 40% of the account. Look for low drawdown (ideally below 20% for a small trader) with a relatively smooth equity curve. A "too good," perfectly straight curve is usually a sign of overfitting.
05Step 5: Optimization (with double the caution)
The Strategy Tester also optimizes — it tests hundreds of parameter combinations to find the "best." It's powerful and dangerous in equal measure. The risk is overfitting: you find the parameters that would have been perfect in the past, but that fail in the future because they were fitted to noise, not signal.
How to optimize without fooling yourself:
- Split the data: optimize on 70% of the period (in-sample) and validate on the remaining 30% (out-of-sample) that the robot never "saw."
- Distrust isolated peaks: if one set of parameters profits far more than its neighbors, that's statistical luck, not robustness. Prefer broad regions of parameters that perform similarly.
- Less is more: a robot with 3 optimizable parameters is more robust than one with 15. Each extra parameter is one more chance to overfit.
Don't have a robot to install yet?
Download our sample EA, commented line by line, ready to run in this tutorial.
06Step 6: VPS — why your robot needs one
Here's what separates a hobby from serious operation. If you run the EA on your personal computer, the robot only works while the machine is on, with internet, and MT5 open. Power cut? Fell asleep and turned the PC off? Internet wobbled? The robot stops — possibly with an open position and no management.
The solution is a VPS (Virtual Private Server) — a computer in the cloud, on 24/7, where your MT5 runs uninterrupted. Advantages:
- 24/5 availability (the Forex market trades 24h on weekdays)
- Low latency — a VPS near the broker's server executes orders faster
- Independence from your machine — you can turn off the PC, the robot keeps going
Many brokers offer a free VPS for those who trade a minimum volume. Alternatively, there are VPS specialized in forex from a few dollars a month. For HFT/scalping, choose a VPS in the same region as the broker's server (usually London or New York). See our VPS guide for the details.
07Final checklist before going live
Before letting the robot trade real money, confirm:
- ☐ A 2-3 year backtest with acceptable drawdown (<20%)
- ☐ Out-of-sample validation (tested on non-optimized data)
- ☐ Ran on a demo account for at least 1 month
- ☐ The demo behavior matches the backtest
- ☐ Auto trading enabled at both levels (global + EA)
- ☐ Lot set to the minimum
- ☐ VPS configured (if you'll trade seriously)
- ☐ You understand what the robot does and when it stops
08Frequently asked questions
My EA isn't trading, what do I do?
Check in this order: (1) the "Algo Trading" button is green in the toolbar; (2) in the EA's settings, "Allow Algo Trading" is checked; (3) a smiley face 🙂 in the corner of the chart; (4) the market is open; (5) the robot's parameters make sense (lot > 0). The problem is almost always item 1 or 2.
What's the difference between .ex5 and .mq5?
.mq5 is the source code (you can edit and compile it). .ex5 is the compiled file (executable, non-editable). Both run on MT5; if you only have the .mq5, MT5 compiles it automatically to .ex5 when loading.
Do I need to pay for a VPS?
Not necessarily. Many brokers offer a free VPS if you keep a minimum volume or balance. If not, forex VPS cost from a few dollars a month. If you only trade during business hours and keep an eye on it, you can start without a VPS — but for 24/5 operation it's practically mandatory.
Can I run the robot on index futures?
Yes, as long as your broker offers MT5 with access to that instrument. You then open the chart (e.g. ES or EURUSD) and run the EA normally. See our day-trade setups guide to understand the market.
Does the backtest guarantee I'll profit?
No. A backtest shows how the robot would have behaved in the past — it's necessary, but not sufficient. The future market differs from the past. That's why a demo account for 1 month is essential: it tests the robot in real, current conditions before you risk capital.
Get a robot running today
Download our sample EA (Python + MQL5) and follow this step-by-step tutorial.
Download the free robot →