What an Expert Advisor is
An Expert Advisor (EA) is a program that runs inside MetaTrader and can open, change and close trades for you. People also call it a forex robot or a trading bot. EAs for MetaTrader 5 are written in MQL5 and EAs for MetaTrader 4 in MQL4. For more on these languages, see MQL4 and MQL5.
An EA follows fixed rules written by its programmer, such as "buy when one moving average crosses above another, with a set stop loss." It cannot judge news, unusual volatility or a sudden gap. It does exactly what its code says, and that includes any mistakes in the code.
MetaTrader has three related kinds of program:
| Program | What it does | Can it trade? |
|---|---|---|
| Expert Advisor | Runs on a chart and reacts to each new price | Yes |
| Indicator | Draws lines or values on a chart | No |
| Script | Runs once when you start it, then stops | Yes, one action |
An EA works only while your terminal is open and connected. If you close MetaTrader or your PC goes to sleep, the EA stops. Open positions stay open but are no longer managed by the EA.
How to install an EA in MT5
- Open MetaTrader 5 and choose File → Open Data Folder.
- Open the MQL5 folder, then Experts.
- Copy the EA file into the Experts folder. A compiled file runs as it is. A source file needs compiling in MetaEditor first.
- Go back to the terminal. In the Navigator window (Ctrl+N), right-click Expert Advisors and choose Refresh.
- The EA now appears in the list.
You can also get EAs from the Market tab in the Toolbox, which links to the official MQL5 Market. EAs from there install themselves into the correct folder.
Only use files from a source you trust. An EA can place trades on your account, and a file that allows DLL imports can run code outside MetaTrader.
How to install an EA in MT4
The steps are almost the same:
- Choose File → Open Data Folder.
- Open MQL4, then Experts, and paste the file.
- Refresh the Navigator or restart the terminal.
An MT4 EA does not run in MT5 and an MT5 EA does not run in MT4. The two languages differ, so a file has to be written or rewritten for the platform you use. See MT4 vs MT5 for other differences.
Enable algo trading
Installing the EA does not let it trade. You have to switch trading on in two places.
Terminal-wide switch. In MT5, click the Algo Trading button on the toolbar or press Ctrl+E. In MT4 the button is called AutoTrading. When it is off, no EA can trade.
Per-EA permission. Drag the EA from the Navigator onto a chart. In the window that opens, go to the Common tab and tick Allow Algo Trading (in MT4: Allow live trading). Click OK.
The EA's name then appears in the top-right corner of the chart. Its icon shows whether it is allowed to trade.
You can set global rules under Tools → Options → Expert Advisors. Examples are whether DLL imports are allowed and which web addresses an EA may contact. Leave DLL imports off unless you know why the EA needs them.
The Experts and Journal tabs in the Toolbox show messages from the EA and from the terminal. Check them first if nothing happens. Common causes are listed on MetaTrader errors.
Inputs: the settings that matter
The Inputs tab in the EA window lists the parameters its author made adjustable. Typical inputs:
- Lot size or risk setting. This is the trade volume per position. A lot is the standard unit of trade size. Check exactly how the EA calculates volume.
- Stop loss and take profit. Usually in points or pips. A pip is the standard small price step of a pair. See Stop loss and take profit.
- Magic number. An ID the EA writes on its trades so it can tell them apart from your manual trades and from other EAs.
- Trading hours, maximum spread, maximum open trades. These are filters that limit when and how much it trades.
- Grid or multiplier settings. These add positions or increase size after losses. Treat them with extra care.
You can save a set of inputs and load it later with Save and Load on the same tab. The chart and its EA are also kept in templates and profiles.
Why "profitable EAs" for sale are a red flag
Many robots are sold through social media, WhatsApp or Telegram with claims of steady monthly profit. Treat these claims with strong suspicion:
- No EA can guarantee profit. Markets change, and rules that worked on past data can fail.
- Screenshots and backtests are easy to fake or curve-fit. Curve-fitting means tuning settings until past results look perfect.
- Martingale and grid robots can show smooth gains for a long time. Then they lose most of an account in one bad move, because they keep adding positions against the trend.
- "Send money and we trade for you" offers, or requests for your login details, are a warning sign in their own right. Never share your password.
The SECP regularly cautions the public against illegal investment and trading platforms promoted through messaging apps. Keep one point in mind: per the SECP, offshore platforms have no Pakistani licence or oversight and offer no legal protection or recourse. Read Law and regulators and Regulation and Safety before you commit money anywhere.
Leveraged forex and CFD trading can lose money fast. An EA can lose it faster, because it trades without pausing.
Ready to try it on a real or demo account?
Partner link · trading carries a high risk of loss
Test before any live use
- Read the logic. Know when the EA enters, exits and adds positions. If the seller will not explain it, that tells you something.
- Run the Strategy Tester. Test across different market periods with realistic spreads. Look at drawdown, the largest fall from a peak, not only the final balance. See Strategy tester.
- Forward-test on a demo account. Run it in real time on a demo account long enough to see different market conditions.
- Check the conditions. Spread, commission and swap (the overnight fee) change results. See Contract specifications and Swap fees.
- Plan for interruptions. Decide how the terminal stays online and what happens to open trades if it disconnects.
General principles for position size and losses are on Risk management.
Frequent questions
What is an expert advisor in MT5?
It is an MQL5 program attached to a chart that can open, manage and close trades automatically according to fixed rules.
Why is my EA not trading?
Usually the terminal's Algo Trading button is off, or "Allow Algo Trading" was not ticked when you attached the EA. Check the Experts and Journal tabs for messages.
Can I use an MT4 EA in MT5?
No. It has to be rewritten in MQL5 or replaced with an MT5 version.
Does the EA keep working if I close MetaTrader?
No. It runs only while the terminal is open and connected.
Is a forex robot a safe way to earn income?
No. An EA only automates rules, and those rules can lose money. Leveraged trading carries a high risk of loss, and an EA does not reduce that risk.
Where do I see which trades the EA made?
Its trades carry its magic number and usually its name in the comment. You can review them in Trade history.
