EX5 to MQL5 Converter: Source Recovery and Rebuilding Options
An EX5 file is the compiled program that MetaTrader 5 runs; MQ5 is the editable MQL5 source file. MetaEditor's documented workflow compiles source into an executable. It does not provide a supported reverse-conversion workflow that restores the original source project. Renaming an EX5 file to MQ5 will not make it editable code.
If you need to change an EA, first determine whether you need its source at all. A setting change, recovery of your own project, and reconstruction of a trading rule are different tasks with different next steps.
What compilation does, and what it does not promise
MetaQuotes' compilation documentation describes lexical, syntax, and semantic analysis followed by code generation and optimization. It says EX5 executables can be distributed without the MQ5 and MQH source files, and that source is required for debugging.
An executable is therefore not a backup of your editable project. Restoring the exact original comments, formatting, and development history is a different problem from analyzing program behavior. Claims that an online service can return your original source should be evaluated on that distinction.
This does not establish that all reverse engineering is technically impossible. It does establish that a file-extension converter is not the documented way to recover an MQL5 project. There is no verified decompiler test behind this article, so it does not present a converter ranking or claim to have tested a particular service.
Start with the change you need
| What you need | First action | When source becomes necessary |
|---|---|---|
| Change a lot-size limit, session, or stop setting | Inspect the EA's exposed inputs and vendor instructions | The required setting is not exposed or behaves differently from what you need |
| Restore an EA you wrote | Search the original development folders and backups | You need MQ5 plus its dependencies to edit and rebuild |
| Modify a purchased EA | Ask the seller about configuration, a custom build, or source licensing | Your purchase may only include the executable |
| Reimplement rules you own or are authorized to use | Write a behavioral specification | You create a new source project and validate it independently |
A .set file preserves input values. It can help reproduce a configuration, but it does not contain the EA's source logic.
Recover your own source before rebuilding
Make a copy of the files you still have, then work through the places where source may exist:
- Open the relevant MT5 installation's data folder. Check
MQL5/Expertsfor MQ5 files andMQL5/Includefor MQH dependencies. Check other terminal installations and old development machines too. MetaQuotes documents these locations in its environment folder reference. - Search your backups, repository history, cloud folders, and the original development handoff. Search by project name and by
.mq5, not just by the EX5 filename. - If you used MetaEditor's version-control storage, check that account and repository. MQL5 Algo Forge's Git menu provides repository retrieval and history operations. Recovery depends on the source having been stored there previously.
- Ask the original developer for the source package, required include files, and build instructions. A single MQ5 file may be insufficient when a project depends on custom indicators, resources, or libraries.
Compile the recovered project in a separate working copy before changing it. Keep its old inputs and test report so you can compare the original behavior with your edited version.
If you purchased the EX5
Check what your purchase actually delivered. The MQL5 Market rules distinguish product-use rights from other rights in the product. A license to run an EA should not be treated as a promise that the seller will provide editable source.
Ask the seller a concrete question: can the requested behavior be configured, will they provide a modified build, or do they offer a separate source-code agreement? For a custom development contract, check its source-delivery terms. Whether a particular reverse-engineering activity is permitted depends on the applicable agreement and law; this article does not make a blanket legal judgment.
Before sending a proprietary binary to an online converter, establish whether you are authorized to share it and what the service will retain. A download button, a screenshot of MQL5, or a promise of "100% recovery" does not demonstrate that the returned program matches yours.
Rebuilding from rules is a new implementation
If source recovery fails but you know the rules and can use them, write down what a replacement must do. A trade history alone usually cannot identify a unique algorithm: several different rules can produce the same observed trades.
Record the details that would otherwise be guessed:
- The symbol, timeframe, indicator inputs, and whether signals use a completed bar.
- Entry and exit conditions, including the order of events when more than one condition occurs.
- Position sizing, stop and target units, maximum exposure, and repeated-entry behavior.
- Account mode, session rules, and behavior after a restart or rejected trade request.
For each rule, include at least one expected trade and one situation where the EA must stay flat. Mark anything you do not know. An AI assistant cannot recover missing rules merely because you supply an EX5 file or an equity curve.
Pineify's MQL5 coding agent can help draft editable MQL5 from that specification. It supports MQL5 reference context and a requested syntax check. This is source generation, not EX5 decompilation, and a passing check does not prove equivalence to the old EA.
Compile the replacement in MetaEditor, inspect trades in the Strategy Tester, and compare decisions on the same historical data and settings where possible. Resolve differences at the trade and rule level rather than trying to force the new equity curve to resemble the old one. Keep a separate period for validation; MetaTrader's forward-testing workflow supports testing optimization results on another period.
The recoverable deliverable is either your original source from a legitimate copy or a new, documented implementation. Treat those as separate outcomes when agreeing on work with a developer or choosing an AI tool.
