To create custom indicators, one has to use MetaQuotes Language 4 (MQL4) and MetaEditor. To launch the editor, one has to execute the "Create" command of the "Navigator Custom Indicators" window context menu, or the "Tools MetaQuotes Language Editor" menu command, or press F4 or the button of the "Standard" toolbar. At creation of the MQL4 program, the Experts Wizard that allows to create new MQL4 programs will open automatically. "Custom Indicator" must be selected in it as the object to be created,
and the necessary fields must be filled out:
Then it is necessary to decide whether the new indicator will be created in a separate sub-window and what range it will have. Besides, it is necessary to define the amount and parameters of the indicator arrays. Values of their elements are used to draw lines in the chart. In other words, when indicator arrays are defined, the lines of the future indicator are defined, too. After that, the window of the new indicator with the defined settings will open. A file with the source code (*.MQ4) of the indicator will be placed into the /EXPERTS/INDICATORS folder of the client terminal automatically. From this point onwards, one can start to write the text of the custom indicator.
After the indicator has been developed, it must be compiled. To do so, one has to execute the "File Compile" editor menu command, press F9 or the button of the toolbar. After the indicator has been successfully compiled, an executable program file with *.EX4 extension will be created to be automatically placed into the /EXPERTS/INDICATORS folder. The list of custom indicators can be viewed in the "Navigator Custom Indicators" window of the client terminal.
To start modifying of the existing indicator from terminal, one has to execute the "Modify" command of the "Navigator Custom Indicator" window context menu. At that, the MetaEditor will open where the selected indicator source code has already been downloaded. After this code has been changed, one will have to recompile it and get a new executable EX4 file. Otherwise, the previous, non-modified version of the indicator will be used in the terminal.
Attention: If the indicator has been compiled with errors, it is impossible to attach it to the chart. At that, the indicator properties window will not appear, and a record about impossibility to open a file with an executable code will appear in the experts journal. |