MetaEditor Help

Creating Classes

Creating Classes

When creating a new class, a new include file template for describing that class is created. This file automatically placed in an MQL5/Include (or MQL4/Include) directory. When creating a class, you can indicate a base class for it. This will be considered in the template as well.

After choosing the corresponding position in the MQL4/MQL5 Wizard and pressing the "Next" button the following window appears:

Creation of Class

The following fields should be filled in this window:

  • Class Name — name of the created class;
  • Include File — name of the mqh file that will be create for description of the class as well as the path to it relatively to the /MQL4 (/MQL5) directory;
  • Base Class — if the created class should be inherited from another class, specify the name of the base class in this field. Next you should select a type of inheritance from the base class;
  • Author — the name of the author;
  • Link — the e-mail or website address of the developer.

Depending on the conditions of calling the MQL4/MQL5 Wizard a corresponding path is substituted in the "Include file" field:

  • If there are no open documents at the moment, the /Include path is substituted;
  • If there are open files, path to the file that is currently active is substituted;
  • If the MQL4/MQL5 Wizard is started in the "Navigator" window, the path to the corresponding folder is substituted.

Once all the necessary fields are filled out, the "Done" button will become active. As soon as it is pressed, the project of the class file will be created and the window for writing its source code will be opened automatically.