Ready to go further
Next: size the trade for your demo
Enter the balance, the risk percent and the stop distance to see the lot an EA will ask for, and whether it is under the minimum.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- An EA is a file. On the MetaTrader platforms it is an .ex4 file for MT4 or an .ex5 file for MT5, and it sits in the Experts folder of the platform data folder.
- The steps are the same in both: open the data folder, copy the file in, refresh the list, drag the EA onto a chart, tick the permissions and look for the smiley or the running icon.
- Menu names and positions vary by version and by the way the platform was built. Treat the steps as a guide and check your own help.
- Do this on a demo account. A wrong setting then costs nothing.
- Most EAs that do nothing are blocked by a switch, a rule or a lot size, not broken. In the made-up example below a 1 percent risk on a $100 account asks for 0.005 lot, under a 0.01 minimum, so the order is refused.
Before you start
Open a demo account with the broker whose platform you will use. A demo uses fake money and real-looking prices, so it is the right place to find out whether an EA loads, trades and sizes as you expect. Know too which platform you have, because MT4 files do not run on MT5 and the other way round. The MT4 versus MT5 page lists the differences.
Only use an EA file you trust. A file can do anything the platform lets it, including placing orders. If you did not write it, read what it says it does and where it came from, and run it on a demo first.
Install it, step by step
- Close or leave the platform open. Either works, but you will need to refresh the list if it is open.
- Open the data folder. In the platform, look under the File menu for an option to open the data folder. The name varies by version.
- Find the Experts folder. Inside the data folder there is a folder for MQL4 (MT4) or MQL5 (MT5), and inside it a folder called Experts.
- Copy the EA file in. Put the .ex4 or .ex5 file there. If you have source code (.mq4 or .mq5) it may need compiling in the editor first, which is built into the platform.
- Refresh the list. In the Navigator panel, right click Expert Advisors and choose Refresh, or restart the platform. The EA should now be listed.
- Allow automated trading. There is a button on the toolbar, usually labelled Algo Trading in MT5 and AutoTrading in MT4. It must be on, which is often shown in green.
- Open a chart. Pick the pair and the time frame the EA was made for.
- Attach the EA. Drag it from the Navigator onto the chart, or double click it. A settings window opens.
- Check the Common tab. Make sure live trading or algorithmic trading is allowed for this EA. Do not tick extras you do not understand, such as allowing imports of outside code, unless the EA needs them.
- Set the inputs. This is where the lot size, the stop distance and the limits live. Read each one. The defaults are the author's choice, not yours.
- Press OK. The EA starts.
How to tell it is running
- In the top right of the chart there should be the EA name with a smiling face in MT4, or a small icon in MT5, not a frowning face or a crossed one.
- The AutoTrading or Algo Trading button is on.
- The Experts tab in the Terminal panel at the bottom shows a line saying the EA was loaded. Open the Journal tab as well.
- Many EAs draw text or lines on the chart, or print a line on every bar. Check what yours should show.
A running EA that has not traded is not necessarily broken. It trades when its rules say so, which may be rarely. Give it time and read the log.
Why it does nothing: the usual causes
- Automated trading is off. The toolbar button, or the setting inside the EA window, is off. This is the most common cause.
- The market is closed. No new prices arrive at weekends or outside a pair's hours.
- Wrong pair or time frame. The EA was made for a different one and its rules never fire.
- A filter is blocking it. A spread limit, a time window or a news filter can keep it from trading all day.
- The account does not allow it. Some account types, or an investor (read only) password login, do not allow trading by a program.
- Not enough margin, or the lot is wrong. The order is refused. See the worked example below.
- The platform lost its connection. The bottom right corner of the platform shows the connection state.
- The file is for the other platform. An .ex4 file will not run on MT5.
The log is your friend. A refused order usually leaves a line with a reason such as invalid volume, not enough money or trading disabled. Read it before changing anything.
Worked example: a lot that is too small to place
This example is made up. An EA sizes each trade to risk 1 percent of the balance with a 20 pip stop. On the pair, one pip on a standard lot is about $10. The platform allows lots in steps of 0.01 with a minimum of 0.01.
| Demo balance | Lot asked for | Lot after rounding down | Percent actually risked |
|---|---|---|---|
| $100 | 0.005 | refused | 0% |
| $300 | 0.015 | 0.01 | 0.67% |
| $500 | 0.025 | 0.02 | 0.80% |
| $700 | 0.035 | 0.03 | 0.86% |
| $900 | 0.045 | 0.04 | 0.89% |
On the $100 demo the EA asks for 0.005 lot. That is under the 0.01 minimum, so the order is refused and the EA looks dead. In the log it would show a volume error. On $500 it asks for 0.025, rounds down to 0.02 and risks 0.80 percent. The rounding also means the risk you set and the risk you get differ. The lot size calculator shows the unrounded figure for your own stop.
After it runs: what to check on the demo
- Does it open trades at the times and prices its rules say? Check the first few by hand.
- Are the lot size and stop what you set? Look at an open order.
- Does it close trades as expected, and do stops sit on the broker's server?
- What are the real spread and slippage compared with those in your test?
- What does it do if you restart the platform with a trade open? Some EAs lose track of their own trades.
Run it for several weeks before judging it, since a few trades say little. If it is to run all day, a stable machine matters too, as the forex VPS page explains. For how to test the idea itself, see backtesting.
What this page does not tell you
It does not cover every version or every broker build, and menu names differ. It does not say any EA is safe or profitable. The numbers are made up. Use your platform's own help for the exact steps.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
Where does an EA file go in MT4 or MT5?
In the Experts folder inside the MQL4 or MQL5 folder of the platform data folder. Open the data folder from the File menu, copy the file in and refresh the Navigator list.
Why is my EA on the chart but not trading?
Common causes are automated trading switched off, a closed market, a wrong pair or time frame, a filter blocking it, or a lot size the platform refuses. The Experts and Journal tabs usually say which.
Can I use an MT4 EA on MT5?
Not as it is. An .ex4 file is for MT4 and an .ex5 file is for MT5. The code has to be ported and tested again.
How do I know the EA is running?
Look for the face or icon in the corner of the chart, the AutoTrading or Algo Trading button being on, and a loaded line in the Experts tab.
Why use a demo account first?
A wrong setting, lot size or a bug costs nothing there. You also see real spread and fill behaviour without risking money.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is general education. Menus vary by version, the numbers are made up and you should check your own platform.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss