EA Source Code vs EX4 and EX5 Files: What Each Lets You Do
EABuild Team · · 8 min read

When you shop for an expert advisor you will meet two kinds of download: compiled EX4 and EX5 files, and source code you can open and edit. This post compares them by what each one lets you do, so you can pick the format that matches how you work in MetaTrader.
What is being compared
An expert advisor (EA, a program that places trades automatically) starts life as text written in MQL, the language MetaTrader uses. That text is the source code: a .mq4 file for MetaTrader 4 or a .mq5 file for MetaTrader 5. MetaTrader cannot run the text directly. A compiler turns it into a machine-readable file, an .ex4 for MT4 or an .ex5 for MT5. That compiled file is what sits in the Experts folder and what the platform loads when you attach the EA to a chart.
So the choice is not between two different robots. It is between two forms of the same program: one you can run, and one you can read and rebuild. The criteria used below are the ones that matter in daily use.
- Running: can you attach it to a chart straight away?
- Reading: can you see how it decides to open and close trades?
- Changing: can you alter the logic, not only the inputs?
- Effort: what do you need to learn or do before it works?
- Risk of mistakes: what can go wrong with each?
For a wider introduction to the formats and to MetaEditor, see the pillar guide on MQ4 and MQ5 source code. This post focuses on the decision itself.
Compiled EX4 and EX5: what you can do
A compiled file is the ready-to-run form. You copy it into the terminal's data folder, refresh the Navigator, attach it to a chart and enable algo trading. If you have never done this, the guide to installing an EA in MT5 walks through it, and the steps for MT4 are almost the same.
What you can change
With a compiled file you work through the EA's inputs window. Inputs are the settings the author chose to expose, such as lot size, trading hours or stop distances. Many EAs also ship with set files (saved lists of input settings you load in MetaTrader), which give you a starting configuration. Our guide on loading a set file in MT4 and MT5 explains that step.
What you cannot do is alter anything the author did not expose. If a rule is built into the logic, such as when the EA skips a trade, you cannot switch it off or adjust it, because the logic is not readable from the compiled file.
What you cannot see
A compiled file runs, but it does not explain itself. You learn how it behaves from the listing, from the input names and from watching it on a demo account. That is a real limit: you cannot check, for instance, whether the EA reads a news feed or how it sizes the next order after a loss.
Source code: what you can do
A source download gives you the text of the program. In MetaEditor, the code editor that installs with MetaTrader, you can open the file, read it, edit it and compile it into a new EX4 or EX5.
Reading the logic
This is the main gain. You can see which indicators the EA reads, what conditions open a trade, how stops are placed and which filters block an entry. The standard parts of an MQL program, such as OnInit and OnTick, are described in the MQL5 documentation.
Changing the logic
You can change default input values, add a time filter, limit the symbols the EA accepts, adjust how lot size is calculated or add log messages that show why a trade was or was not opened. You can also use the code to learn how an EA is organised.
What it costs you
Source code is not a shortcut. A bare .mq4 or .mq5 file must be compiled before it runs, and compile errors need some reading. A source package may also contain a compiled file, as the Smart Gold Hunter MQ5 package does (1 compiled, 1 source). After you edit, every change is yours to test. A change that compiles is not a change that works, and a slip in order handling can open positions you never intended.
Side-by-side table
| Question | Compiled EX4 or EX5 | Source MQ4 or MQ5 |
|---|---|---|
| Runs on a chart as it is | Yes | A bare MQ4 or MQ5 file: no, it must be compiled first. A source package may also hold a compiled file |
| Logic readable | No | Yes, in MetaEditor |
| Inputs and set files | Yes, through the inputs window | Yes, once compiled; you can also change the defaults in the code |
| Logic changeable | No | Yes, then recompile |
| Setup effort | Copy the file, attach, set inputs | For a bare source file: copy, open in MetaEditor, compile, then attach |
| Main risk | Behaviour you cannot inspect | Your own edits changing how it trades |
| Platform match | EX4 for MT4, EX5 for MT5 | MQ4 for MT4, MQ5 for MT5 |
The last row matters for both. The MQL4 and MQL5 languages are close cousins, not twins, so a file for one platform does not simply move to the other.
An example from the shop: the same EA in two forms
Smart Gold Hunter is listed in this shop in both forms for MetaTrader 5, which makes the difference easy to see. Both listings describe an EA for XAUUSD (gold) on the M5 and M15 timeframes, with scalping, news trading and hedging logic, at version 3.5 and a recommended minimum deposit of $100.
The Smart Gold Hunter EA for MT5 download is the compiled form. Its package holds three compiled files, which are the EA file and two helper files, plus six set files. It has no source code, and its listing states unlimited live and demo accounts. You attach it, load a set file and review the inputs.
The Smart Gold Hunter EA Source Code (MQ5) download is the editable form. Its package holds one compiled file, one source file and six set files. You can open the MQ5 file in MetaEditor, read how the entries and exits are written, and recompile it after a change. Neither listing uses a DLL.
The six set files in each package are starting configurations, not a recommendation of results. Both listings mark the EA as built with prop-firm challenge rules in mind. Rules on EAs, hedging and news trading differ by firm, so read your firm's terms first.
Which format fits which reader
Compiled files fit you if
- You want to run an EA and tune it through inputs and set files.
- You are not interested in programming, or have no time for it right now.
- You want the shortest path from download to a demo test.
Source code fits you if
- You want to read how the EA makes its decisions before you trust it with an account.
- You write or want to learn MQL and plan to adjust the logic.
- You need a change that the inputs window cannot give you, such as a different filter.
Some readers want both: the compiled form to run and the source form to study. That is a fair way to work, as long as you keep the two clearly labelled so you do not mix a modified build with an untouched one.
What to check before you trade live
- Confirm the platform: EX4 and MQ4 are for MT4, EX5 and MQ5 are for MT5.
- If you compiled the code yourself, make sure the build finished without errors, and read any warnings.
- Keep an untouched copy of the download, and change one thing at a time.
- Test on a demo account first, and watch behaviour around wide spreads and news releases.
- Check the settings against your broker's contract size, spread and account type.
- Check what the product page and the terms of use say before you share or publish any code you changed.
This shop sells digital downloads and is not the developer or publisher of the EAs, so questions about how a program was designed belong with its author. A tester run on stored prices shows how logic behaved in the past, and it does not predict future results.
Where to go next
You can browse every EA source code download in the catalogue, and every product in the shop is included in the membership.
Trading foreign exchange and CFDs carries a high level of risk and may not be suitable for all investors. Past performance does not guarantee future results; only trade with money you can afford to lose.
Tags: EA Source Code, MetaEditor, MQL5


