Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>MQL ToolsNew to Visual Studio Code? Get it now.
MQL Tools

MQL Tools

L-I-V

|
43,838 installs
| (21) | Free
Tools MetaQuotes Language 4/5
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

The MQL Tools extension adds language support for MQL (MetaQuotes Language) to VS Code, including functions:

1. Checking the syntax of mqh/mq4/mq5 files (without compilation).

2. Compilation of mq4/mq5 files.

3. Compilation of mq4/mq5 files using script.

The script opens the file "mq4/mq5" in the "MetaEditor" and clicks the "Compile" button, thus MT4/MT5 is automatically updated. (The idea is taken from here)

4. Opening the MQL help:

To find a keyword in the MQL help, place the cursor on it or select it, and then press F1.

5. In the explorer context menu, added items:

  • New MQL File : Opens the window for creating a new MQL file.

  • Compile : Compile the selected file directly from the context menu of the explorer without opening it.

  • Compile with script : Compile the selected file directly from the context menu of the explorer without opening it.

  • Open in 'MetaEditor' : Open the selected file in “MetaEditor” directly from the explorer context menu.

  • Show/hide ex4/ex5 files : Show or hide compiled ex4/ex5 files in the explorer view.

  • Insert MQH as #include : Insert the selected mqh file as a #include directive in the current file.

  • Insert the file name 'mq4/mq5' in 'mqh'

    (When the "mq4/mq5" file name is specified in the "mqh" file, it allows for improved real-time error checking in the "mqh" file itself. This also eliminates the need to switch to the "mq4/mq5" file window during compilation. In the first line of the "mqh" file, you need to write the name of the "mq4/mq5" file. Example: //###<Experts/Examples/MACD Sample.mq5>)

6. Creating a comment for a function.

7. MQL color highlighting and editing with a color picker.

8. Quick Print().

This tool facilitates debugging of code using the Print() function.

  • To use it, place the cursor on a variable or select it, then press the key combination Ctrl+Alt+D.

  • Start typing ‘mp’, then press Tab or Enter to insert Print() with data from the clipboard.

  • The context menu of the editor has added the following items under 'MQL Tools': Comment out all Print(), Uncomment all Print(), Remove all Print().

9. Folding regions.

  • Allows you to manually mark regions of code that can then be collapsed and expanded. To collapse a region of code, wrap it between the //#region and //#endregion comments:
//#region
double overbought;
double oversold;
int    period_rsi;
int    period_sm;
int    period_rnk;
//#endregion
  • You can give the region a name, which will be displayed in the minimap. ( Display of region names in the minimap can be disabled in VS Code settings: editor.minimap.showRegionSectionHeaders )
//#region global variables
double overbought;
...
//#endregion
  • If editor.minimap.showRegionSectionHeaders is disabled, you can still force the name to appear in the minimap by adding the MARK: prefix:
//#region MARK: global variables
double overbought;
...
//#endregion

10. The 'Styler'.

The 'Styler' tool performs the same functions as the standard SHIFT+ALT+F code formatting or the standard CTRL+K CTRL+F selection formatting, provided the code is selected. However, the 'Styler' does not add spaces to date and color string literals. (D_'2023.12.29 18:33:56', C_'128,128,128')

  • To use the 'Styler', open the 'MQL Tools' menu from the context menu of the editor or use the 'MQL Tools' menu button on the main panel of the editor and select the 'Styler' item.
  • You can also choose the code formatting style in the 'MQL Tools' menu.

11. IntelliSense.

  • Autocomplete for variable, constant, and function names - IntelliSense suggests names that can be used in code and provides auto-completion for them.
  • Display of function information - when the mouse cursor hovers over a function name, IntelliSense displays information about the function, including a list of parameters, return type, and description.
  • Notification of errors - IntelliSense provides real-time information about errors, which helps quickly find and correct mistakes before code compilation.

12. MQL syntax highlighting.

Quick Setup Guide:

  1. Open the folder with MQL files in VSCode. Example: C:\Users\<your name>\AppData\Roaming\MetaQuotes\Terminal\D2E7219F73C8BF37CD8BF550E55FF075\MQL5. (The folder must be named MQL4 or MQL5! This is important!!! Otherwise, the extension will not work.)

  2. Specify the path to MetaEditor in the extension settings and, if necessary, the path to "Include" files.

  3. Create or update the “settings.json” configuration file if it exists. Press Ctrl+Shift+P to open the command palette, select "MQL: Create configuration".

  4. If you wish, you can set icons for MQL files. Press Ctrl+Shift+P to open the command palette, select "MQL: Add icons to the theme", then select a theme to which icons will be added (icons can be added only to certain 4 themes).

Important:

  • The “MQL Tools” extension is not a full-fledged replacement of MetaEditor. The main processing of MQL code is performed by the “C/C++” extension, which is due to the differences between the MQL and C/C++ languages. In this regard, there may be cases when some operations with MQL code may not be performed as expected or may be limited in their capabilities.
  • The code formatting styles presented in the extension are only a demonstration. You can use your own styles: to do this, open the menu “MQL Tools” → “Select a formatting style” → “Custom”. MQL code formatting is part of the “C/C++” extension.

Recommendations:

  • When working in MacOS and Linux.
    • If possible, avoid using spaces in paths and file names.
    • Compilation and code verification can take a long time. To speed up these processes, it is recommended to always keep the MetaTrader trading terminal open. It is also recommended to open the MetaTrader trading terminal through the 'MQL Tools' menu.
  • If some functions stopped working with MQL code, but the "MQL Tools" extension was not updated, check if the "C/C++" extension was updated. If the "C/C++" extension has been updated, try installing an earlier version of it.

Release Notes:

0.1.0

  • Initial release

0.1.1

  • Added 'error' and 'warning' icons to the output channel
  • Added Help in Korean
  • Added Korean translation of errors and warnings in the output channel
  • Added 'Portable MT4' and 'Portable MT5' items to the extension settings

0.1.2

  • Fixed a bug when working with the 'portable' version of MetaTrader

0.1.3

  • Fixed an error when opening help when there are spaces in the path to the '.chm' file

2.0.0

  • Improvements have been made to the operation of IntelliSense
  • Real-time code error checking has been added, with indication of errors through wavy lines in the editor
  • A tool has been added to simplify working with the Print() function during code debugging.
  • Added the ability to use the ${workspaceFolder} variable in the path to include files and metaeditor.exe
  • The comment creation tool for functions has been updated
  • Syntax highlighting in the output channel has been changed
  • Added the function of automatically creating the 'settings.json' file, which is located in the '.vscode' folder

2.0.1

  • Improvements have been made to checking the code for errors in real time
  • Changes have been made to Insert MQH as #include

2.0.2

  • Fixed the bug that caused the errors "command 'mql_tools.compileFile' not found", "command 'mql_tools.compileScript' not found" and the like

2.1.0

  • Added the ability to compile on Linux and MacOS using Wine
  • Added downloading of up-to-date help versions
  • Added code formatting styles
  • Methods for matrix and vector have been added to IntelliSense
  • Added Menu 'MQL Tools' button to the main menu of the editor
  • Added Compile and Compile with script items to the Explorer menu
  • The Fixing date time and color after formatting item has been replaced by Styler in the 'MQL Tools' menu
  • Added items to the 'MQL Tools' menu:
    • Open 'MetaEditor'
    • Open trading terminal
    • Insert Color as clrColor
    • Select formatting style

2.2.0

  • Added Folding regions
  • Added New MQL File items to the Explorer menu
  • Added the ability to stop the compilation and verification process
  • Added possibility to select SIMD instructions at compilation (MQL5)
  • Added possibility to select compilation with or without optimization (MQL5)
  • Added option to enable strict compilation mode
  • Added possibility to copy mql files to the MQL4/5 directory of the MT4/5 catalog after compilation
  • Added description of “interface” methods in IntelliSense
  • Added workspace name validation: the extension will only work if the workspace name is MQL4 or MQL5
  • Added Wine Prefix ME4 and Wine Prefix ME5 items to the extension settings
  • Fixed (issue 6, issue 47, issue 53, issue 55, issue 79, issue 80, issue 90)
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft