Now I am compiling my MetaTrader .mq4
files to .ex4
files with MetaEditor.
But my .mq4
files are generated by a Java-process, and I would like to automate the compilation process.
Is there a command-line compiler tool I could call programmatically?
This is a little late, but since I wrote a little script for UltraEdit/UEStudio and have received heaps of help from stackoverflow, here is my script. It compiles then copies the ex4 to a number of test MT4 installations:
The "Compile" button on UE does:
Normally my source code is in a library tree under D:\Development\MQ4[Group][ExpertName][FileName].mq4
Contents of D:\Development\MQ4\MT4Compile.bat:
All the best.
Shawky
Yes, there is an executable in the install directory of the terminal. It is called metalang.exe.
To compile a source code file from a command line, you can use MetaEditor for that. For example:
For 64-bit use
metaeditor64.exe
instead.In Linux/macOS, this can be achieved using Wine, e.g.:
For mass compilation, you can specify folder, like:
To specify custom MQL5/MQL4 folder with include files, you can use
/inc
parameter, for example:For additional information about the compilation process, you can use
/log
:To check for the syntax only, add extra
/s
.If the compilation fails, the
MQL4.log
file would be created in the platform folder with the relevant details.To specify the custom compilation log file, use
/log:file.log
parameter, e.g.Note: Display to the standard output is not supported (although on Linux you can use:
/log:CON
).For more information, check: Compilation from the Command Line
Some time ago you could download the compiler of MQL4/MQL5 programs that runs separately from MetaEditor —
MQL.exe
. It was distributed separately from the terminal and you could download it at the following addresses:Usage (as per MQL4/MQL5 Compiler build 1162 from 02 Jul 2015):
However the standalone compiler was intentionally removed, so now links point to the installer in favor of MetaEditor.
Much older version of MetaTrader prior to build 600 had
metalang.exe
included with the platform.However in build 616, MetaQuotes intentionally has removed the compiler (
mql.exe
/mql64.exe
) from the standard MetaTrader installation.This means if you upgrade your MT platform (>616), the compiler executable will be removed.