Compile using console command?

 

Is there any console command that can compile the mq5 file? For example: 

"mql5 -compile ./strategy101.mq5 ./strategy101.ex5"

If so, I can use other code editors such as sublime text for development by setting a build environment. 

The default MetaEditor cannot fold the code and it is already becoming a problem to go back and forth in one large file containing many event handlers.

 

In mt4 you could recompile your mq4 code using API functions from mql4 programs

Check blog  TheXpert 

There is open source code

 
ALXIMIKS:

In mt4 you could recompile your mq4 code using API functions from mql4 programs

Check blog  TheXpert 

There is open source code

I can't open this link. Not sure why. Is it still good? 

 
Take it ))
Files:
 
ALXIMIKS:
Take it ))
Thanks!
 
nicolasxu:

Is there any console command that can compile the mq5 file? For example: 

"mql5 -compile ./strategy101.mq5 ./strategy101.ex5"

If so, I can use other code editors such as sublime text for development by setting a build environment. 

The default MetaEditor cannot fold the code and it is already becoming a problem to go back and forth in one large file containing many event handlers.

For your information.

Console compiler MQL4/MQL5 stayed updated with the platform MetaTrader 4/5 and is always available on the links:

DLL files are no longer needed him.

 
ALXIMIKS:
Take it ))
MetaLang.exe is no more available.
 
angevoyageur:
For your information.
Very cool! Thanks!
 

I tried compiling MQL4 from command line and I have found this: https://www.metatrader5.com/en/metaeditor/help/development/compile


You have the metaeditor.exe or metaeditor64.exe which can compile code with /compile:file.mq4 or /compile:file.mq5 and even include your own includes with /inc:[includes directory], write the output into a file with /log:file.txt and so on.


For Sublime text 3 I use the following build script (in case anyone needs it as an example), which includes opening help files:

{
	"variants": [
		{
			"name": "Compile Expert",
			"cmd": [
				"C:\\Program Files (x86)\\SimpleFX MetaTrader 4 Terminal\\metaeditor.exe",
				"/compile:$file",
				"/log:${project_path:${folder}\\\\${file_base_name}}.log",
				"/inc:$folder\\Personal\\alexandru.chiri\\MQL4",
				"&",
				"type",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"del",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"echo",
				"Deploy ex4 to Experts:",
				"&",
				"copy",
				"${file_base_name}.ex4",
				"%appdata%\\MetaQuotes\\Terminal\\E5A4E68F1B7E15DF3B06ED6AF0EC4859\\MQL4\\Experts\\",
				"&",
				"del",
				"${file_base_name}.ex4",
				],
			"shell": true
		},
		{
			"name": "Compile Indicator",
			"cmd": [
				"C:\\Program Files (x86)\\SimpleFX MetaTrader 4 Terminal\\metaeditor.exe",
				"/compile:$file",
				"/log:${project_path:${folder}\\\\${file_base_name}}.log",
				"/inc:$folder\\Personal\\alexandru.chiri\\MQL4",
				"&",
				"type",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"del",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"echo",
				"Deploy ex4 to Indicators:",
				"&",
				"copy",
				"${file_base_name}.ex4",
				"%appdata%\\MetaQuotes\\Terminal\\E5A4E68F1B7E15DF3B06ED6AF0EC4859\\MQL4\\Indicators\\",
				"&",
				"del",
				"${file_base_name}.ex4",
				],
			"shell": true
		},
		{
			"name": "Compile Script",
			"cmd": [
				"C:\\Program Files (x86)\\SimpleFX MetaTrader 4 Terminal\\metaeditor.exe",
				"/compile:$file",
				"/log:${project_path:${folder}\\\\${file_base_name}}.log",
				"/inc:$folder\\Personal\\alexandru.chiri\\MQL4",
				"&",
				"type",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"del",
				"${project_path:${folder}\\\\${file_base_name}}.log",
				"&",
				"echo",
				"Deploy ex4 to Scripts:",
				"&",
				"copy",
				"${file_base_name}.ex4",
				"%appdata%\\MetaQuotes\\Terminal\\E5A4E68F1B7E15DF3B06ED6AF0EC4859\\MQL4\\Scripts\\",
				"&",
				"del",
				"${file_base_name}.ex4",
				],
			"shell": true
		},
		{
			"name": "MetaTrader 4 Help",
			"cmd": [
                "start",
                "",
				"hh.exe",
				"%appdata%\\MetaQuotes\\Terminal\\Help\\mql4.chm"
			],
            "shell": true
		},
		{
			"name": "MetaTrader 5 Help",
			"cmd": [
                "start",
                "",
				"hh.exe",
				"%appdata%\\MetaQuotes\\Terminal\\Help\\mql5.chm"
			],
            "shell": true
		}
	]
 }
Compiling - Creating Programs - MetaEditor Help
Compiling - Creating Programs - MetaEditor Help
  • www.metatrader5.com
Any file (*.MQ4, *.MQ5 or *.MQH) can be compiled, but an executable file (*.EX4 or *.EX5) can be generated only as a result of the compilation of the main MQ4 or MQ5 file of a program. Compiled executable EX4/EX5 files can be distributed without source MQ4, MQ5 or MQH files. Debugging is impossible without them. It is recommended not to...
Reason: