MetaEditor Help

Intellectual Control

Different tools, from the auto substitution of names and tips of functions to bookmarks and hotkeys, are implemented in MetaEditor for the convenient development of programs. These means allow to quicken up the process of the source code writing, conveniently navigate through it and avoid mistakes.

The following functions are described in this section:

Any changes made to the source code can be rolled back using the "Undo Undo" command in the "Edit" menu, in the "Standard" toolbar or using the "Ctrl+Z" key combination.

Auto Substitution of Function Names

It is the possibility of viewing the list of variants of names of built in and user functions, constants, variables, members of classes, keywords, etc. The variants of substitution are determined by the first typed symbols. Opening of this list is performed automatically when writing the source code. In order to manually open this list one should use the "List Names List Names" command in the "Edit" menu, in the "Standard" toolbar or use the "Ctrl+Space" key combination after the first symbols of the name are typed:

List of Names

Further it is only left to choose the necessary variant using the "Arrow Up" and "Arrow Down" keys and then press the "Enter" key. The choice can be made using the mouse as well. If one continues to type the letters of the function name, the list of possible variants of substitution will get shorter.

Information about Parameters

This feature allows viewing parameters of a chosen function and their types. In order to open this information one should execute the "Parameter Info Parameter Info" command in the "Edit" menu, in the "Standard" toolbar or use the "Ctrl+Shift+Space" key combination. The commands must be executed when the mouse cursor is within the brackets where the parameters are specified. The pop-up help line containing the parameters will appear below the function as soon as you do it:

Information about Parameters

Let's consider the displayed information in the example shown in the screenshot above:

  • [1 of 2] — it means that there are two variants of parameters specification for the function. In order to switch between them one should use the "Arrow Up" and "Arrow Down" keys or click with the left mouse button on the tip line;
  • bool — it indicates the type of the values returned by the function;
  • ObjectSetInteger — the name of the function;
  • (long chart_id, ... ) — the enumeration of possible parameters of the function, the type of the parameter is specified before each of them ("long" in this case). The parameter where the mouse cursor currently is displayed bold.

Go To Definition

This function allows to automatically move to the declaration or definition of the selected function or variable. If the definition or declaration is in another file, then this file will be opened and the mouse cursor will be moved to the corresponding position. This function also allows to move to the include files (#include).

In order to go to definition one should place the cursor at a parameter and execute the "Go To Definition Go To Definition" command in the "Edit" menu, in the "Standard" toolbar or use the"Alt+G" key combination. In order to go to an include file one should place the cursor at the line where it is declared and execute one of the commands mentioned above.

List of Functions

This feature allows to open the list of all declared functions in the current file. In order to open the list one should execute the "List Functions List Functions" command in the "Edit" menu, in the "Standard" toolbar or use the "Alt+M" key combination.

List of Functions

The parameters that were specified for the functions are shown in brackets. By clicking with the left mouse button or using the "Enter" key one can go to the definition of the selected function in the file. Each type of the function has its own icon in the list:

  • Function — function;
  • Fucntion of Events Handling — function of events handling (On*);
  • Public Method of Class — public method of a class;
  • Protected Method of Class — protected method of a class;
  • Private Method of Class — private method of a class;

Comments Inserting

Different commands for working with comments in the source code are implemented in the "Edit" menu and in the "Standard" toolbar:

  • Function Header Function Header — insert a ready field for a comment to a function;
  • Block Comment Block Header — insert symbols of a single-line comment;
  • Comment Lines Comment Lines — insert the "//" comments in the beginning of each selected line;
  • Uncomment Lines Uncomment Lines — remove the "//" comments from the beginning of each selected line.

The execution of the "Block Comment Block Comment" or the usage of the "Ctrl+/" key combination inserts the symbols of a single-line comment at the indicated position:


If the "Function Header Function Header" or the "Ctrl+." key combination is used then the workpiece for a comment to the function will be inserted at the indicated position:

//|                                                                  |

Additional Functions for Code Editing

The "Additional" submenu of the "Edit" menu contains several commands for easier editing a source code:

  • Increase Line Indent Increase Line Indent — this command allows inserting three spaces (or a tab character) at the beginning of selected lines. To insert spaces in a single line, put the mouse cursor at the beginning of the line and execute this command (or press the "Tab" hotkey). To insert spaces in several lines, select the whole lines.
  • Decrease Line Indent Decrease Line Indent — this command allows removing three spaces (or a tab character) from the beginning of selected lines. The same action can be performed using the Tab+Shift key combination.
  • Make Uppercase Make Uppercase — this command makes all the letters of a selected phrase uppercase. The same action can be performed using the Ctrl+Shift+U key combination.
  • Make Lowercase Make Lowercase — this command makes all the letters of a selected phrase lowercase. The same action can be performed using the Ctrl+U key

Working with Bookmarks

Bookmarks are intended for denoting necessary lines in the source code for further convenient navigation through them. The commands for working with bookmarks are located in the "Bookmarks" submenu of the "Edit" menu, in the "Standard" toolbar and in the context menu of the text. There are the following commands for working with them in MetaEditor:

  • Toggle Bookmark Toggle Bookmark — toggle or untoggle a bookmark on the current line of the edited file depending on its current state. The same action can be performed using the "Ctrl+F2" key combination;
  • Next Bookmark Next Bookmark — move to the next bookmark in the current source code. The same action can be performed using the "F2" key;
  • Previous Bookmark Previous Bookmark — move to the previous bookmark in the source code. The same action can be performed using the "Shift+F2" key combination;
  • Clear All Bookmarks Clear All Bookmarks — clear all bookmarks from the current file. The same action can be performed using the "Ctrl+Shift+F2" key combination.

MetaEditor includes the feature of working with named bookmarks - bookmarks that have a one-digit identifier assigned. To set such a bookmark press a 0-9 digit key holding the "Ctrl" key. To go to a previously set key, press the corresponding digit key while holding the "Alt" key. Name bookmarks make the navigation through a source code much easier.

Go To Line

To quickly go to a line in the code of the current file, one can use the "Go To Line Go To Line" command of the "Edit" menu or the "Standard" toolbar. The following window is opened as soon as this button is pressed:

Go To Line

The range of lines containing code in the file is specified in the window. To go to a line, one should indicate its number and press the "OK" button.


To make writing of a code easier, MetaEditor includes a possibility of inserting snippets — small template fragments of code that describes a structure element of the MQL4/MQL5 language. To insert a snippet you should type a special keyword. As soon as you do it, the cursor will change to A snippet can be inserted, what means that a snippet can be inserted. The next step is to press the "Tab" key.

For example, to insert a class declaration, type the keyword "class" and press the "Tab" key:

Example of snippet

As soon as you do it, the keyword will be replaced with a class declaration. To switch between the active fields of a snippet (in this case? they are the name, constructor and destructor of a class), use the "Tab" and "Shift+Tab" keys.

If you change an active field, the other fields of the snippet will be changed automatically. For example, if you change the class name, the names of the constructor and destructor will be changed automatically; if you change a variable name in one of the expressions of a "for" operator, the names of variables in its other expressions will also be changed.

The system of working with snippets recognizes structures, classes, enumerations, methods and functions if your press the "Ctrl+Enter" key combination. At that the cursor must be within description of the corresponding structural element. As soon as that combination is pressed, the user will be able to move between members (for classes, structures and enumerations) and arguments (for methods and functions) using the "Tab" and "Shift+Tab" keys as well as to edit them together as described above.

At this moment, the following snippets are supported:




Declaration of an import.


Event handler OnBookEvent.


Event handler OnCalculate.


The "case" selector.


Event handler OnChartEvent.


Declaration of a class.


Event handler OnDeinit.


Declaration of the "do while" loop.


Declaration of an enumeration.


Declaration of the "for" loop.


Declaration of the "if" condition.


Declaration of the "else" condition.


Event handler OnInit.


Event handler OnStart.


Declaration of a structure.


The "switch" selector.


Event handler OnTester.


Event handler OnTesterInit.


Event handler OnTesterPass.


Event handler OnTesterDeinit.


Event handler OnTick.


Event handler OnTimer.


Event handler OnTrade.


Event handler OnTradeTransation.


Declaration of the "while" loop.

Resources Inserting

To make using of resource files in developed applications easier, the "Insert Resources Insert Resources" command is implemented in the "Tools" menu. This command allows declaring resource files from a selected folder in the current file using the #resource directive.

Once this command is executed, the standard dialog window of your operating system appears. In it you should select one or several resource files to be declared in the file.

  • Resource files can be located only within the /MQL5 (or /MQL4) directory of the client terminal. Files outside that directory cannot be used.
  • Only *.wav and *.bmp files can be used as resource files.

Once the above actions are performed, the corresponding directives will be added to the beginning of the file. For example:

#resource "\Images\example.bmp"
#resource "resources\example.bmp"

The path to resource files can be specified in two ways:

  • Relatively to the current file (without the "\" symbol at the beginning of path)
    This way is used in case the resource files are located in the same directory as the current file or in one of its subfolders.
  • Relatively to the /MQL5 (or /MQL4) directory of the client terminal (the "\" symbol is specified at the beginning of path)
    This way is used in all other cases.