Trading forex and CFDs on leverage is high risk. Most retail accounts lose money. Read the risk warning

How to Install an Expert Advisor on MT4: Files, Settings and Fixes

To install an expert advisor on MT4, open File, then Open Data Folder, copy the EA's .ex4 or .mq4 file into MQL4, then Experts, restart MetaTrader 4 (or refresh the Navigator), and drag the EA from the Navigator onto a chart. Then switch on the AutoTrading button and tick "Allow live trading" in the EA's settings, and a smiling face in the chart's top-right corner tells you it is running. Most installation problems come from using the wrong folder, a missing dependency or a setting that is still switched off.

Key takeaways

  • Always use File, Open Data Folder; the folder under Program Files is usually not the one MT4 reads.
  • EAs go in MQL4\Experts, custom indicators in MQL4\Indicators, DLLs in MQL4\Libraries and preset files in MQL4\Presets.
  • Three switches must be on: AutoTrading on the toolbar, "Allow live trading" on the EA, and DLL imports if the EA needs them.
  • An EA only trades while the terminal is open and connected, which is why many traders use a VPS.
  • Install and run on a demo account first, and only run software from sources you trust.

What you are installing: .ex4, .mq4 and the rest

An MT4 expert advisor usually arrives as one of two file types. A .mq4 file is the source code, readable and editable in MetaEditor. A .ex4 file is the compiled program MetaTrader actually runs. Many commercial EAs are distributed only as .ex4 so the logic stays private. If you receive a .mq4, MT4 compiles it automatically on restart, or you can open it in MetaEditor (F4) and press F7 to compile and see any errors.

Some EAs come as a bundle. Typical extras are custom indicators the EA calls (.ex4 or .mq4), a DLL for functions MQL4 cannot do natively, a .set file holding pre-configured inputs, and occasionally a chart template (.tpl). Each has its own folder, and putting them in the wrong one is the most common reason an EA "does nothing".

FileWhat it isFolder inside the data folder
.ex4 / .mq4 (EA)The expert advisorMQL4\Experts
.ex4 / .mq4 (indicator)Custom indicator used by the EAMQL4\Indicators
.dllExternal libraryMQL4\Libraries
.mqhInclude file (only needed to compile source)MQL4\Include
.setSaved input settingsMQL4\Presets
.tplChart templatetemplates

Step 1: Find the correct data folder

Since build 600, MT4 stores user files in a separate data folder, normally under your Windows user profile in AppData, rather than in the installation directory under Program Files. Copying an EA into Program Files is the classic mistake: the file is there, but MT4 never sees it.

The reliable way in is from inside the terminal. Click File, then Open Data Folder. A Windows Explorer window opens at the right place for that particular installation. If you have several MT4 terminals from different brokers, each has its own data folder, so open it from the terminal you intend to use. Inside you will see the MQL4 folder and, within it, Experts, Indicators, Libraries, Include and so on.

Step 2: Copy the files in

Copy the EA file into MQL4\Experts. You can create a subfolder, such as MQL4\Experts\MyVendor, to keep things tidy; MT4 will show it as a folder in the Navigator. Then copy any indicators, DLLs and preset files to their matching folders from the table above. If a ZIP file from the vendor already mirrors this folder structure, you can usually copy its MQL4 folder over the top of yours and let Windows merge them.

Before copying anything, consider where it came from. An .ex4 or DLL from an unknown Telegram channel or file-sharing site is a program that will have permission to place trades on your account, and a DLL can do anything a Windows program can. Stick to software from a known developer, the MetaQuotes Market, or code you have read yourself.

Step 3: Refresh and confirm MT4 can see it

Close and reopen MetaTrader 4, or right-click Expert Advisors in the Navigator panel (Ctrl+N if it is hidden) and choose Refresh. The EA should now be listed under Expert Advisors. If it appears greyed out, MT4 found the file but could not use it, usually because a .mq4 failed to compile or a .ex4 was compiled for an incompatible build. Open the Terminal window (Ctrl+T) and check the Journal and Experts tabs for an error message.

Step 4: Enable automated trading globally

Go to Tools, Options, then the Expert Advisors tab. The settings that matter:

  • Allow automated trading. Must be ticked for any EA to place orders.
  • Disable automated trading when the account has been changed / when the profile has been changed. Safety switches; leave them on unless you have a reason not to.
  • Allow DLL imports. Only tick this if your EA needs a DLL, and only for software you trust. You can leave it off globally and allow it per EA instead.
  • Allow WebRequest for listed URL. Needed only if the EA contacts a web server, for example a licence check or a news filter. Add the exact URLs the vendor documents.

Then check the AutoTrading button on the main toolbar. It is green when on and red when off. It is a global kill switch: turning it off stops every EA in the terminal from opening new trades.

Step 5: Attach the EA to a chart

Open a chart of the symbol and timeframe the EA is designed for; the vendor's instructions should say which. Drag the EA from the Navigator onto the chart, or double-click it. A settings window opens with two key tabs.

Common tab

Tick "Allow live trading". Choose whether long, short or both directions are allowed, and tick "Allow DLL imports" here if the EA needs it. Leave "Allow import of external experts" off unless instructed.

Inputs tab

This is where lot size, risk, stop-loss, take-profit, magic number and any filters are set. If the vendor supplied a .set file, click Load and choose it. Read every input before clicking OK. Pay special attention to anything named like "multiplier", "recovery", "grid step" or "max trades", which often switch on averaging-down logic.

Click OK. In the top-right corner of the chart, the EA's name appears with a face icon. A smiling face means it is running and allowed to trade. A frowning face means trading is disabled, either because AutoTrading is off or "Allow live trading" was not ticked. To change settings later, press F7 on the chart.

Step 6: Check it is behaving, on demo first

Run every new EA on a demo account before risking money, even if it is a well-known product. Watch the Experts tab in the Terminal window, which logs messages from the EA, and the Journal, which logs orders and errors. Confirm that position sizes match what you expect. A quick calculation helps: if the EA is set to risk 1% of a $5,000 account with a 25-pip stop on EUR/USD, the risk is $50, which at $10 per pip per standard lot means 0.20 lots. If you see trades of 2.0 lots, something is misconfigured, and that is far better discovered on demo.

It is also worth backtesting before going live. MT4's Strategy Tester (Ctrl+R) runs the EA on historical data, and for accurate results on scalpers you may want real tick data, covered in our guide to 99.9% tick data backtesting in MT4.

Important risk point: installing an EA hands control of order placement to a program. A bug, a bad setting or a strategy built on averaging down can lose money far faster than manual trading, and leverage magnifies those losses. Most retail forex and CFD accounts lose money. Only install software from sources you trust, never share your trading password with an EA vendor, run it on demo first, and know how to stop it instantly (click AutoTrading off or remove the EA from the chart).

Keeping an EA running: terminal, VPS and broker rules

An EA only works while MT4 is open, logged in and connected. Close the terminal, let your computer sleep or lose your internet connection and the EA stops managing trades, which can leave positions open without the exits it was supposed to handle. For that reason many traders run MT4 on a virtual private server. You can rent a Windows VPS from a hosting provider, use a VPS some brokers offer to clients who meet certain conditions, or use the MetaQuotes virtual hosting service available from inside the terminal. Our comparison of forex VPS hosting explains the trade-offs, including how proximity to your broker's server affects latency.

Broker and account rules matter too:

  • US accounts follow NFA FIFO and no-hedging rules, with 50:1 leverage on majors. EAs that hedge or close trades out of order will throw errors or behave differently.
  • UK, EU and Australian retail accounts are capped at 30:1 on major pairs, which can trigger margin problems for EAs designed on high-leverage offshore accounts.
  • Prop firm accounts often restrict third-party EAs, high-frequency trading or tick scalping. Check the rules before installing; see prop firms that allow expert advisors.
  • Some brokers limit order frequency or minimum holding time. Our guide to the best brokers for automated EA trading covers what to look for.

Troubleshooting common MT4 EA problems

SymptomLikely causeFix
EA not in NavigatorCopied to Program Files or another terminal's folderUse File, Open Data Folder from the right terminal; refresh
EA greyed outCompile failure or incompatible .ex4Check Journal; recompile .mq4 in MetaEditor; ask vendor for a current build
Frowning face on chartAutoTrading off or "Allow live trading" untickedTurn on AutoTrading; press F7 and tick the box
"DLL calls are not allowed"DLL imports disabledAllow DLL imports for that EA, if you trust it
"Cannot load indicator"Required custom indicator missing or renamedCopy it to MQL4\Indicators with the exact file name
Error 130 (invalid stops)Stop too close to price or wrong digits handlingCheck broker's stop level; adjust EA settings for 5-digit pricing
Error 134 (not enough money)Lot size too large for marginReduce lot size or risk setting
No trades at allWrong symbol suffix, timeframe, session filter or news filterCheck vendor instructions and the Experts tab log

If you are on a Mac, note that most MT4 builds for macOS run through a compatibility layer, and some DLL-based EAs do not work there. A Windows VPS avoids that problem. If you also use MetaTrader 5, the process is similar but the folders and some settings differ; see how to install an expert advisor on MT5, and note that MT4 .ex4 files will not run in MT5.

Frequently asked questions

Where do I put an EA file in MT4?

Inside the terminal, click File, then Open Data Folder, and place the .ex4 or .mq4 file in MQL4\Experts. Do not copy it into the Program Files installation folder, because modern MT4 builds read user files from the separate data folder. Restart MT4 or refresh the Navigator and the EA will appear under Expert Advisors.

Why is my expert advisor not trading in MT4?

Check the face icon in the chart's top-right corner. A frown means AutoTrading is off or "Allow live trading" was not ticked. If it is smiling, look at the Experts and Journal tabs for errors such as invalid stops or not enough money, and confirm the symbol, timeframe and session or news filters match the vendor's instructions. Some EAs simply wait a long time for their conditions.

Can I run more than one EA in MT4 at the same time?

Yes. Attach each EA to its own chart; only one EA can run on a single chart. If two EAs trade the same symbol, give each a different magic number so they do not manage each other's trades. Watch total margin and combined risk, since several EAs can open positions at once and the overall exposure adds up quickly.

Do I need to keep my computer on for an MT4 EA to work?

Yes. The EA runs inside the terminal, so MT4 must be open, logged in and connected. If the computer sleeps or loses internet, the EA stops working and open trades may not be managed as intended. Many traders use a Windows VPS or the built-in MetaQuotes virtual hosting to keep the EA running around the clock.

Can I use an MT4 EA on MT5?

No. MT4 runs .ex4 files written in MQL4 and MT5 runs .ex5 files written in MQL5. The languages differ in how orders, positions and indicators work, so an EA must be rewritten or ported. Some vendors sell both versions; if you only have MT4 source code, a programmer can convert it, but it needs retesting afterwards.

Is it safe to allow DLL imports in MT4?

Only for software you trust. A DLL is native Windows code that runs with the same permissions as the terminal, so a malicious one could do far more than place bad trades. Leave DLL imports off globally, enable them only for the specific EA that needs them, and avoid EAs from anonymous sources that require DLLs.

This article is general information, not personal financial advice. Figures such as spreads, fees, leverage and rules change; confirm them with the provider and check the provider is authorised for your country of residence.