Custom Indicator Creation
Indicators are used to analyze past and current price information to help traders predict future price movement. In addition to a wide variety of technical indicators included in the platform, traders can create their own Custom Indicators based on specified factors. In MT4, Custom Indicators are created, setup and launched using the same process as Experts (see the Expert Advisor Creation section of this tutorial). To open the Experts Wizard, right-click Custom Indicators in the Navigator window and select "Create," as shown in Figure 12.
Figure 12 - To make a new indicator, right-click on Custom Indicators within the Navigator Window and select "Create."
|Figure 13 - Creating a Custom Indicator in the Expert Advisor Wizard|
The "General properties of the Custom indicator program" window appears. Here, traders must specify the:
- Name - a user-created name for the Custom Indicator
- Developer - the developer's name
- Link - to the developer's Website, if applicable
- Inputs - the list of Custom Indicator inputs
Figure 14 - Specify the parameters in the "General properties of the Custom indicator program" window within the Expert Advisor Wizard.
The "Drawing properties of the Custom indicator program" window appears. Here, traders can specify the indicator's drawing properties that will determine the Custom Indicator's appearance, as shown in Figure 15.
Figure 15 - Specify the drawing properties of the Custom Indicator.
Once the drawing properties have been specified, click "OK" to close the window. A new window appears in the MQL4 programming environment. The name of the Custom Indicator appears at the top of the window, and the previously entered parameters are listed near the top of the code, as shown in Figure 16.
Figure 16 - The Name and Inputs now appear in the programming environment.
From here, the Custom Indicator code can be entered into the window using the MQL4 programming language and syntax.
Note: Specifics regarding programming are outside the scope of this tutorial; understanding programming logic and learning a specific language require significant effort. Traders can learn more about programming in the MQL4 environment by reading the MT4 Help Guides and participating in the active MQL4 community forums.
Custom Indicator Compiling
After the coding has been completed, it must be compiled to ensure that the code has been written in the proper format to be able to run the Custom Indicator. To compile the Custom Indicator:
- Select File > Compile; or
- Click the Compile button on the toolbar; or
- Press F5 on the computer keyboard.
Figure 17 - Errors found during the compiling process. Double-click the error to pinpoint the error in the code. In this case, what should have been written "int" was coded incorrectly as "iint." Deleting the erroneous "i" fixed the error.
Once all errors have been fixed, again try to compile the code. After successful compilation, the new Custom Indicator will appear in the Navigator - Custom Indicators window. If the Custom Indicator did not compile successfully, it will still appear but its icon will be gray and it cannot be used.
SEE: How To Build A Trading Indicator Custom Indicator Setup
Like Experts, Custom Indicators need to be set up before they can be launched. To set up Custom Indicator parameters, open the Options window and select the "Expert Advisors" tab. To open the window:
- In the Main Menu > Tools > Options; or
- Pressing CTRL + O on the computer keyboard.
- Allow DLL imports -to use DLLs to enhance Expert functionality.
- Allow external experts imports - to allow the Expert to access functions from other Experts or MQL4 libraries.
After the Custom Indicator has been created and setup, it is ready to be launched. To launch a Custom Indicator:
- Right-click on the Custom Indicator in the Navigator - Custom Indicator window and select "Attach to a chart"; or
- Double-click on the Custom Indicator in the Navigator - Custom Indicator window; or
- Drag-and-drop the Custom Indicator to the desired chart.
Figure 18 - Attaching the Custom Indicator to an active price chart.
Modifying Indicator Settings
Traders can change the inputs and appearance of a Custom Indicator that is attached to a price chart. To do so, double-click the Custom Indicator to open the format window. Make any desired changes in the Common, Inputs, Colors and Visualization tabs, and click "OK" to accept the changes.
Removing a Custom Indicator
To remove an indicator from a price chart, right-click the indicator and select "Delete Indicator," as shown in Figure 19.
|Figure 19 - Right-click and select "Delete Indicator" to remove an indicator from the price chart.|
Advanced Guide To MetaTrader 4 - Scripts
Small BusinessCustomer service is the part of a business tasked with enhancing customer satisfaction.
TradingSelect multiple indicators, avoid information overload and optimize indicators to effectively use technical analysis tools.