MQ5 to MQ4 Converter

Convert MetaTrader 5 source (.mq5) into a MetaTrader 4 migration draft (.mq4). Review supported changes and compatibility warnings before compiling.

Moving from MetaTrader 5 to MetaTrader 4

MQ5 and MQ4 share much of their language syntax, but platform behavior differs. This tool creates a conservative migration draft for MT4 build 600 and later. Your original calculations, comments, strings and function bodies are preserved.

What converts automatically?

Supported standalone PlotIndexSet calls with literal plot indices from 0 to 7 map to MT4 setters for labels, arrows, shifts, draw start, empty values, and supported line styles. The MT5 indicator_plots directive is removed and MT4 strict compilation is enabled. Shared modern event handlers such as OnInit and OnTick remain in place.

Indicator handles and CopyBuffer

MT5 indicators commonly return handles, while MT4 built-in indicators return values for a specified bar shift. Handle creation, CopyBuffer calls, custom indicator dependencies and cleanup need coordinated changes. The converter flags these patterns instead of guessing their meaning or changing calculation order.

Trading operations need manual review

MT5 distinguishes orders, deals and positions. MT4 primarily uses order tickets. CTrade, position access, trade requests and deal history cannot be translated safely through simple name replacements. Review trade sizing, stops, execution results and hedging behavior before testing.

Review, compile and compare

Upload your .mq5 source, choose its original program type if detection is uncertain, then review the automatic changes and warnings. Download the .mq4 draft, compile it in MetaEditor 4 and resolve remaining errors. Compare calculations and trading behavior with the MT5 original using historical data and a demo account.

Need the other direction? MQ4 to MQ5

MQ5 to MQ4 Converter FAQ

Source files, supported changes and MT4 compatibility.

Is the MQ5 to MQ4 converter free?

Yes. Upload an MQ5 source file up to 1 MB with no registration. UTF-8 and UTF-16 files with a BOM are supported.

Does it guarantee a working MT4 program?

No. The output is an uncompiled migration draft. MT5 trading, indicator handles, platform services and unsupported plot settings need manual migration and testing.

Can I upload an EX5 file?

No. Only .mq5 source files are supported. Compiled .ex5 files cannot be converted or decompiled by this tool.

Is my source uploaded to a server?

No. Conversion runs locally in your browser. Your source is not sent to a conversion API or stored on our servers.

Are modern event handlers supported in MT4?

MT4 build 600 and later supports modern handlers such as OnInit, OnTick, OnStart and the full OnCalculate signature. MT5-only events and the short OnCalculate form need manual adaptation.

Can I also convert MQ4 to MQ5?

Yes. Use our separate MQ4 to MQ5 converter to create an MT5 migration draft.

Migration draft disclaimer

Automated changes do not guarantee compilation or identical behavior. Review every warning, compile in MetaEditor 4 and test on a demo account before use.