Advanced Guide To MetaTrader 4 - Custom Indicators
  1. Advanced Guide To MetaTrader 4 - Introduction
  2. Advanced Guide To MetaTrader 4 - Automated Trading
  3. Advanced Guide To MetaTrader 4 - Expert Advisors
  4. Advanced Guide To MetaTrader 4 - Custom Indicators
  5. Advanced Guide To MetaTrader 4 - Scripts
  6. Advanced Guide To MetaTrader 4 - Strategy Testing And Optimization

Advanced Guide To MetaTrader 4 - Custom Indicators

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."
The Expert Advisor Window opens; select the "Custom Indicator" as the object to be created and click "Next" to continue, as shown in Figure 13.

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
To add a new parameter to the Inputs field, press the "Add" button. For each Parameter, the trader must specify the Name, Type and Initial Value, as shown in Figure 14. To delete a parameter, highlight the parameter and press "Delete." These become the Input Variables within the Custom Indicator. Once all the inputs have been listed, click "Next" to continue.

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.
Once compiling has been initiated, an update appears in the Toolbox beneath the code in the MetaEditor window. Any errors will appear here; double-click an error to pinpoint the error in the code, as shown in Figure 17.


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.
Two options influence the operation of Custom Indicators:

  • 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.
Custom Indicator Launch
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.
A window appears with Common, Inputs, Colors and Visualization tabs, as shown in Figure 18. Review the settings in each tab and make any necessary changes, and then click "OK" to attach the Custom Indicator to the active price 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

  1. Advanced Guide To MetaTrader 4 - Introduction
  2. Advanced Guide To MetaTrader 4 - Automated Trading
  3. Advanced Guide To MetaTrader 4 - Expert Advisors
  4. Advanced Guide To MetaTrader 4 - Custom Indicators
  5. Advanced Guide To MetaTrader 4 - Scripts
  6. Advanced Guide To MetaTrader 4 - Strategy Testing And Optimization
RELATED TERMS
  1. Customer

    An individual or business that purchases the goods or services ...
  2. Mass Customization

    The process of delivering wide-market goods and services that ...
  3. Hybrid Indicator

    A technical indicator that combines core elements of chart analysis ...
  4. Customer Relationship Management - CRM

    The principles, practices, and guidelines that an organization ...
  5. Negative Verification

    A system of confirming that a bank's records agree with a customer's ...
  6. Customer's Loan Consent

    An agreement signed by the customer of an investment firm. The ...
RELATED FAQS
  1. What is the difference between market indicators and economic indicators?

    Read about the differences between technical market indicators and general economic indicators, and learn how traders and ... Read Answer >>
  2. How do I start using technical analysis?

    Technical analysis is a method of analyzing securities by evaluating current and historical price and/or volume activity. ... Read Answer >>
  3. What is a common strategy traders implement when using the Money Flow indicator?

    Learn a common trading strategy traders implement with the money flow indicator to identify profitable trade entry and exit ... Read Answer >>
  4. What are leading, lagging and coincident indicators? What are they for?

    An indicator is anything that can be used to predict future financial or economic trends. For example, the social and economic ... Read Answer >>
  5. What does it mean when they refer to the churn rate of a telecommunications company?

    Learn what companies in the telecommunications industry mean when they refer to a churn rate, and discover tactics companies ... Read Answer >>
  6. What are the most common market indicators experienced traders follow?

    Take a look at some of the most popular market indicators used by technical analysts, including the advance/decline line ... Read Answer >>
Hot Definitions
  1. Labor Market

    The labor market refers to the supply and demand for labor, in which employees provide the supply and employers the demand. ...
  2. Demand Curve

    The demand curve is a graphical representation of the relationship between the price of a good or service and the quantity ...
  3. Goldilocks Economy

    An economy that is not so hot that it causes inflation, and not so cold that it causes a recession. This term is used to ...
  4. White Squire

    Very similar to a "white knight", but instead of purchasing a majority interest, the squire purchases a lesser interest in ...
  5. MACD Technical Indicator

    Moving Average Convergence Divergence (or MACD) is a trend-following momentum indicator that shows the relationship between ...
  6. Over-The-Counter - OTC

    Over-The-Counter (or OTC) is a security traded in some context other than on a formal exchange such as the NYSE, TSX, AMEX, ...
Trading Center