A template is a basic source code of an indicator. It contains the standard program header, general properties and workpieces for the main event handlers: value re-calculation (OnCalculate) and indicator launch (OnInit). A template is created in the directory corresponding to a program type – MQL5/Indicators (or MQL4/Indicators). When creating a template, you can define the program inputs beforehand, as well as add them to the workpiece code for additional event handlers and graphical constructions.
Fill in the following fields:
The input parameters are "input" class variables. To create a parameter, click Add and fill in three fields:
Next, select additional event handlers. The workpieces for them are to be inserted into the EA template. OnCalculate handler is mandatory, so you can only select its type, but not delete it.
To view an extended handler description, move the cursor over it.
Selected handlers are added in addition to the main ones – OnInit and OnCalculate. |
The following parameters are specified at this stage:
In Plots section, you can specify graphical indicator constructions: name, type (for example, line or histogram) and color. In the indicator code, the corresponding properties of constructions, as well as buffers for values are added.
Click Finish to complete template creation. A generated file is immediately opened for editing.