MetaEditor Help

Creating Templates of Expert Advisors

Creating Templates of Expert Advisors

An Expert Advisor template is a file designed for writing a source code. After it has been created, it is automatically placed in an MQL5/Experts (or MQL4/Experts) directory. During the creation a user can select event handlers that will be added to the template.

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

Creation of Expert Advisor

The following fields should be filled out in this window:

  • Name — the name of the Expert Advisor, the same name will be given to its file;
  • Author — the name of the author;
  • Link — the e-mail or website address of the developer;
  • Parameters — a set of input parameters (external variables) of the Expert Advisor.

Variables of the "input" class refer to external parameters. In order to create a parameter one should press the "Add" button. There are three fields that should be filled out in the appeared entry:

  • Name — the name of the input variable;
  • Type — the type of the input variable that is chosen from the list;
  • Initial Value — the initial value of the variable that will be used on default before it is manually changed.

Once all the necessary fields are filled out, the "Next" button will become active.

Event Handlers

At this step you can select additional event handlers that will be inserted into the Expert Advisor template. All the necessary parameters will also be specified for the selected handlers; it's helpful for programmers.

Select Event Handlers

To select one or more event handlers put a checkmark against them. If you hold the mouse cursor over a handler name, a pop-up help containing extended description of the handler will be shown.

Selected handlers are added in addition to the main ones — OnInit(), OnDeninit and OnTick().

Tester Event Handlers

At this step you can select additional tester event handlers that will be inserted into the Expert Advisor template. These handlers are intended for controlling the process of optimization in the real time mode.

Tester Event Handlers

To select one or more event handlers put a checkmark against them. If you hold the mouse cursor over a handler name, a pop-up help containing extended description of the handler will be shown.

To finish creating the template you should press the "Finish" button. As soon as it is pressed, the window for writing the source code of Expert Advisor will be opened automatically.