MetaEditor Help

Integration with other IDEs

Integration with other IDEs

MetaEditor allows you to write code not only in MQL4 and MQL5. You can also edit and compile the C++ and Python source code. In addition, you can use MetaEditor as an external compiler in other development environments.

Editing C++ code and DLL compilation

When developing trading programs on MQL4/MQL5, you can easily use third-party C++ DLLs. You can edit C++ source code files (CPP and H) similarly to MQ4, MQ5 and MQH ones. These files in DLL can also be compiled directly from the editor. Microsoft Visual Studio installed on user's PC can be used for that. To compile, open the C++ file and press F7 (Compile command).

Working with DLLs on C++

  • MS Visual Studio compiler installed on a user's PC is used for compiling C++ source codes. MS Visual Studio 2008 and higher (including Express and Community versions) are supported.
  • MS Visual Studio version (32 or 64-bit) should match MetaEditor version.

MetaEditor also provides the ability to easily add exported DLL functions to MQL4/MQL5 file. Simply drag a DLL file from the Navigator window to the open MQ4, MQ5 or MQH file.

Importing functions from DLL

Using Python scripts

The are a lot of machine learning, process automation, as well as data analysis and visualization libraries for the Python language. The advanced language possibilities can now be applied in the platform through the Python integration module.

  • Exchange data can be easily and quickly obtained from the trading platform and then analyzed using Python tools: hundreds of thousands of financial symbol ticks can be requested with one command
  • Obtain account trading state and trading history to calculate statistics
  • Perform trading operations following your own algorithm

Python scripts run directly on platform charts, similarly to regular MQL5 programs.

MetaEditor features special integrated functions for Python development: a wizard for creating blank scripts, the ability to run directly from the editor, output of messages and errors to the common log, and so on.

Running a script in the editor

Compiling MQL programs in other development environments #

A MetaEditor executable file can be used as the compiler when working with a source code in external editors. The compiler is started from the command line, specifying the path and name of the file you want to compile:

  • metaeditor.exe /compile:"<full path to the source file>"
  • metaeditor64.exe /compile:"<full path to the source file>"

Example

"C:\Program Files\TradingPlatform\metaeditor64.exe" /compile:"C:\Program Files\TradingPlatform\MQL5\Scripts\myscript.mq5"

Mass compilation of files in a directory

For mass compilation, set the path to a folder rather than to a file. All source code files in the specified folder will be compiled. Subfolders are not included.

Re-compilation is not performed if a source file already has the appropriate compiled version.

The example below displays mass compilation for the \MQL5\Scripts folder

Example

"C:\Program Files\TradingPlatform\metaeditor64.exe" /compile:"C:\Program Files\TradingPlatform\MQL5\Scripts"

Custom MQL5/MQL4 folder with include files

Programs can use include files (*.mqh) and resource files (*.bmp, *.wav, *.ex4, *.ex5), which are located outside the working directory of the current platform (for example, in the \MQL5 folder of another platform copy on the same computer). Specify the path to this folder using the "/include" key for correct compilation. During compilation, the files will be searched as follows:

  • Include files: [specified directory]\include\[path from #include<...>]
  • Resource files: [specified directory]\[path from #resource "..."]

Example

"C:\Program Files\TradingPlatform\metaeditor64.exe" /compile:"C:\Program Files\TradingPlatform\MQL5\Scripts" /include:"C:\Program Files\TradingPlatform 2\MQL5"

Compilation log

Specify the additional /log key for more information about the compilation process. In this case, <source file name>.log compilation log file is created in the folder containing the source file.

Example

"C:\Program Files\TradingPlatform\metaeditor64.exe" /compile:"C:\Program Files\TradingPlatform\MQL5\Scripts\myscript.mq5" /log
Log file: C:\Program Files\TradingPlatform\MQL5\Script\myscript.log

Syntax check

To check a program syntax without compilation, launch MetaEditor from the command line with the /s and /log keys (so that results of the check are displayed in the log file).

Example

"C:\Program Files\TradingPlatform\metaeditor64.exe" /compile:"C:\Program Files\TradingPlatform\MQL5\Scripts\myscript.mq5" /s /log
File with the results of the check: C:\Program Files\TradingPlatform\MQL5\Script\myscript.log