What you should know about indicators


Dozens of articles about indicators are available on this site. You'll find here examples of indicators and articles about how to create indicators. However, a beginner may have some difficulties choosing where to start when learning how to create indicators. So here are a few tips to help you find useful materials.

The very first article on this topic is MQL5: Create Your Own Indicator. It describes the concept of a technical indicator adopted by the MQL5 language and the MetaTrader 5 Client Terminal:

What is an indicator? It is a set of calculated values that we want to be displayed on the screen in a convenient way. Sets of values are represented in programs as arrays.

Thus, creation of an indicator means writing an algorithm that handles some arrays (price arrays) and records results of handling to other arrays (indicator values).

The next article is Applying One Indicator to Another. One of the advantages of the MQL5 language is the possibility to construct an indicator based on the values of another indicator, and all calculations do not require much resources:

When writing an indicator that uses the short form of the OnCalculate() function call, you might miss the fact that an indicator can be calculated not only by price data, but also by data of some other indicator (no matter whether it is a built-in or custom one). Do you want to improve an indicator for its correct application to the other indicator's data? In this article we'll review all the steps required for such modification and outline additional rules for correct creation of such an indicator.

Read the following article to learn how to create a handle of an indicator to make its values accessible: MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors:

In order to obtain values of a built-in or custom indicator in an Expert Advisor, first its handle should be created using the corresponding function. Examples in the article show how to use this or that technical indicator while creating your own programs. The article describes standard indicators of the MQL5 language. It is intended for those who don't have much experience in the development of trading strategies and offers simple and clear ways of working with indicators using the offered library of functions.

For each standard technical indicator included into the MQL5 language pack, you can find examples of use with detailed comments. You can copy the example in the MetaEditor 5, compile it and run in the terminal. The appearance and the display order of indicator buffers in the Data Window is very much similar to the built-in indicator of the same name.

Another detailed explanation of how to create an indicator is available in the article Custom Indicators in MQL5 for Newbies:

Any new subject seems complicated and hard-to-learn for a newbie. Subjects that we know seem very simple and clear to us. But we simply do not remember, that everyone has to study something from scratch, and even our native language. The same is with the MQL5 programming language that offers wide possibilities of developing one's own trading strategies, you can start learning it from basic notions and simplest examples. Interaction of a technical indicator with the MetaTrader 5 client terminal is consider in this article on the example of the simple custom indicator SMA.

Article How to Call Indicators in MQL5 contains a description of how to create an indicator handle using the IndicatorCreate() function. This method has its advantages if compare to the traditional use of iCustom():

With new version of MQL programming language available not only the approach of dealing with indicators have changed, but there are also new ways of how to create indicators. Furthermore, you have additional flexibility working with indicator's buffers - now you can specify the desired direction of indexing and get exactly as many indicator's values as you want. This article explains the basic methods of calling indicators and retrieving data from the indicator's buffers.

Read Event handling in MQL5: Changing MA period on-the-fly to learn that MQL5 indicators can handle events, providing additional flexible opportunities:

Suppose that simple MA (Moving Average) indicator with period 13 is applied to a chart. And we want to change the period to 20, but we do not want to go to indicator properties dialog box and edit the number 13 to 20: simply tired of these tedious actions with mouse and keyboard. And especially we don't want to open indicator code and modify it. We want to do all this with a single press of a button - "up arrows" next to the numeric keypad. In this article I describe how to do it.

If you want to develop a more complex indicator that calculates its value based on several instruments, please read Creating a Multi-Currency Indicator Using a Number of Intermediate Indicator Buffers:

There has been a recent rise of interest in the cluster analyses of the FOREX market. MQL5 opens up new possibilities of researching the trends of the movement of currency pairs. A key feature of MQL5, differentiating it from MQL4, is the possibility of using an unlimited amount of indicator buffers. This article describes an example of the creation of a multi-currency indicator.

Another useful article is Creating Multi-Colored Indicators in MQL5. Color management has become even easier, the number of available predefined colors is 64. Moreover, these colors can be replaced at any time:

In this article, we will consider how to create multi-colored indicators or color the existing ones. MQL5 allows to represent the information in the convenient form. Now it isn't necessary to look at a dozen of charts with indicators and perform analyses of the RSI or Stochastic levels, it's better just to paint the candles with different colors depending on the values of the indicators.

Article Designing and Implementing New GUI Widgets based on CChartObject Class describes some features of MQL5 indicators connected with the ude of graphical objects:

After I wrote a previous article on semi-automatic Expert Advisor with GUI interface it turned out that it would be desirable to enhance interface with some new functionalities for more complex indicators and Expert Advisors. After getting acquainted with MQL5 standard library classes I implemented new widgets. This article describes a process of designing and implementing new MQL5 GUI widgets based on CChartObjectEdit that can be used in indicators and Expert Advisors.

This is not an exhaustive list of useful articles, but this should be enough to make you feel confident about the topic. You can add your own comments to this review about what article is worth reading and what's so useful in it in your opinion.

Pasi Hakamaki
Yummy, thank you for this :)



Francis Dogbe
Francis Dogbe  



Awesome presentation. Thanks for the good work
sathish kumar
sathish kumar  

nice indicator and video too... thanks mann

William Roeder
William Roeder  
MetaQuotes Software Corp.: Dozens of articles about indicators are available on this site. You'll find here examples of indicators and articles about how to create indicators

There is also my multi-post for MT4 and MT5
          How to do your lookbacks correctly.

Alberto Lucadello
Alberto Lucadello  
Thanks a lot for this )
Syed shujhat bukhari
Syed shujhat bukhari  
Try to learn how to read news and events then use indicators otherwise indicators will gives you only loss

Nice post.