Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 has classes?
berix
88
berix 2015.06.11 11:04 
The Metaeditor help states you can run a compiler downloadable from:

https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql.exe — 32 bit version.
https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mql64.exe — 64 bit version.

That compiler is started from the command line (or from a script or from source code editors), specifying the path and name of the file that you want to compile. There are two documented parameters:

•/s — If you run the compiler with this key, it will only check the program code syntax and shows respective results;
•/i :[path] — with this key, you can specify the path to the /MQL4 or /MQL5 directory of the client terminal. This parameter is required, for programs that often use additional include files (*.mqh).

Example of running the compiler with the additional key:
C:\Compiler\>mql.exe C:\MyPrograms\script.mq5 /i:C:\client_terminal\MQL5
 

There is obviously another way to compile from a command line with metaeditor.exe itself which turns out to include the compiler.

One can notice that terminal.exe launches metaeditor.exe at startup to compile not already compiled .mq4 files. The command line looks like:

"C:\Program Files (x86)\Broker\metaeditor.exe" /compile:"C:\Users\TheUser\AppData\Roaming\MetaQuotes\Terminal\03900B798063128E530AEEA6086AF682\MQL4\Indicators\indicator.mq4" /inc:"C:\Users\TheUser\AppData\Roaming\MetaQuotes\Terminal\03900B798063128E530AEEA6086AF682\MQL5" /flg:2 /stop:se1234_1234567

Shown syntax is:

<path>metaeditor.exe /compile:<path>code.mq4 /inc:<path>\MQL5 /flg:2 /stop:value

what are those /inc, /flg and /stop parameters for?

Are there other parameters?

Ovo Cz
2958
Ovo Cz 2015.06.11 13:00  
Interesting. Whatever the parameters are, it worked for me (i.e. compiled an mq4 file) when I left them as they were. The stop does not necessary need to be present with the command to work.
/
To add comments, please log in or register