Indicators are often used to implement trading strategies when working on the interbank Forex market. There are a number of ready-made and proven indicators built into the MetaTrader trading terminal. But if you need to implement an author's strategy, you can create a custom indicator yourself using the built-in capabilities of the MetaQuotes Language (MQL) programming language.
Download, install and launch the MetaTrader trading terminal. To launch the editor of advisor programs, execute the "New" command of the "Navigator-Custom Indicators" window menu. Other ways to start the editor:
- execute the command "Service-Editor MetaQuotes Language";
- press the F4 button;
- click the corresponding MetaEditor button on the "Standard" panel. The above actions will automatically open the program editor.
On the toolbar of the program editor, click the "New" button, which will open the wizard for creating advisor programs. Specify "Custom Indicator" as the type of the created program.
Fill in the fields by entering the required data: indicator name, author's name, developer's website address or his email address.
Adjust the parameters of the future indicator. To add a new parameter, click the "Add" button, to remove an unnecessary parameter, click the "Delete" button.
Next, specify whether your custom indicator will be created in a separate window, and also specify the indicator boundaries. Set the number and characteristics of the indicator arrays (they are used to display lines on the exchange rate chart). After completing the specified actions, a new indicator window with the required parameters will open in the program editor.
Proceed directly to writing the custom indicator program code.
After writing the text of the program (in accordance with the strategy you have adopted), compile the indicator. To do this, press the F9 key, the button on the editor toolbar, or select the "File-Compile" menu. If there are no errors after compilation, an executable file in *.EX4 format is created. The list of custom indicators you have created is displayed in the "Navigator-Custom Indicators" window of the trading terminal.
To overlay the indicator on the exchange rate chart, double-click on it in the "Navigator-Custom Indicators" window and click "OK".