Download MetaTrader 5

Comparative Analysis of 30 Indicators and Oscillators

20 May 2008, 11:32
2 656


The abundance of indicators and oscillators developed nowadays inevitably leads to the problem of choosing the most efficient of them. Very often a beginning trader first facing this plenty of available analysis and forecasting tools starts testing them on history data and demo accounts. After that a set of conclusions is made about the efficiency and uselessness of this or that indicator in certain situations.

However such an estimation is not always objective because of the large number of parameters (symbol, chart period, volatility, etc.) and therefore the large amount of the analyzed information. More reliable conclusions about certain indicators and oscillators can be made after conducting their comparative analysis.

Actually the comparative analysis of indicators and oscillators is impossible without their simultaneous consideration bounding them to a price chart. However attaching even ten different indicators to a chart considerably overloads it. The obtained figure becomes tangled and unsuitable for analysis. An Expert Advisor described in this article can solve this problem and make the conduction of the comparative analysis more convenient.

Expert Advisor

Pay attention, this EA is not intended for the execution of live trading and therefore does not contain the money management block. Block of trade execution is implemented in a very simple way. The main task of the Expert Advisor is the provision of information about the presence or absence of signals from different indicators in connection with a price chart.

The program analyzes the following indicators and oscillators:
  1. Acceleration/Deceleration — АС
  2. Accumulation/Distribution - A/D
  3. Alligator & Fractals
  4. Gator Oscillator
  5. Average Directional Movement Index - ADX
  6. Average True Range - ATR
  7. Awesome Oscillator
  8. Bears Power
  9. Bollinger Bands
  10. Bulls Power
  11. Commodity Channel Index
  12. DeMarker
  13. Envelopes
  14. Force Index
  15. Ichimoku Kinko Hyo (1)
  16. Ichimoku Kinko Hyo (2)
  17. Ichimoku Kinko Hyo (3)
  18. Money Flow Index – MFI
  19. Moving Average
  20. MACD (1)
  21. MACD (2)
  22. Moving Average of Oscillator (MACD Histotgram) (1)
  23. Moving Average of Oscillator (MACD Histotgram) (2)
  24. Parabolic SAR
  25. RSI
  26. RVI
  27. Standard Deviation
  28. Stochastic Oscillator (1)
  29. Stochastic Oscillator (2)
  30. Williams Percent Range

For the implementation of this task a digital matrix consisting of "-1", "0" and "1" is drawn on a chart. Each matrix line belongs to a certain indicator or oscillator. The matrix columns are formed at each moment of time (according to the selected chart period). The appearance of "-1" in a certain matrix line denotes the presence of a signal to sell produced by a certain indicator (oscillator); appearance of "1" - presence of a buy signal, "0" denotes the absence of any signal. Fig. 1 illustrates the program operation results.

Fig. 2 illustrates the analysis of RVI operation based on the matrix. In the line 26 (it contains data about this indicator) "1" is recorded when the main line moves above the signal one (the indicator recommends to buy), "-1" - when the signal line is above the main one (Sell signal). Due to the indicator characteristics this line does not contain "0".

Due to characteristics of indicators and oscillators, we can detect two types of indexes in the matrix: constantly significant ones, the corresponding flags (values in the matrix) of which are never equal to zero, and pointwise significant, the flags of which can accept zero and make signals only in some certain moments of time (for example, Parabolic SAR). It is shown in Fig. 3.

It is recommended to analyze the obtained information and then form a package of indicators the following way. First of all select the chart part with a trend. Then the period of possible trades is specified. The beginning of such a trend can be a flat period before the selected trend or trend origination; the end of the period is the last time moment when a trade is still profitable. Thus anticipatory and late indicator signals are not taken into account. In fig. 4 such a period is indicated by green lines. After that information by indicators (oscillators) is analyzed inside this period: all indicators showing trend correctly are taken, other ones are shifted away. After that the package can be extended or restricted by the analogous analysis on other time intervals, as a result the final package will be formed.

The program provides the testing of formed packages. For this purpose in a corresponding line of the strategy processing Block enumerate conditions (indicator showings) based on which the final decision about selling (or buying) is made.

Thus the combined analysis of the price behavior and signals produced by each certain indicator (oscillator) provides the possibility of selecting the most efficient of them for further formation of a package of indicators.


At the first stage values of "flags" (-1, 0, 1) are defined for each indicator (oscillator). Assuming that one indicator (for example, MACD) produces signals different ways (convergence/divergence, crossing of a zero line, etc.), the program code contains the description of its defining principle. For example, analysis of the oscillator "Williams Percent Range" is implemented so:

//30. Williams Percent Range
//Buy: crossing -80 upwards
//Sell: crossing -20 downwards
if (iWPR(NULL,piwpr,piwprbar,1)<-80&&iWPR(NULL,piwpr,piwprbar,0)>=-80)
if (iWPR(NULL,piwpr,piwprbar,1)>-20&&iWPR(NULL,piwpr,piwprbar,0)<=-20)

After that unique objects of the 'Text' type are formed from the obtained digital values of flags (to avoid duplication of object names current time value is used) and the displayed:

timeident=TimeCurrent(); //Time to form the unique object name
for (i=0;i<=29;i++) //Loop for displaying values
//Forming unique object names
{ident=DoubleToStr(30-i,0)+"   "+DoubleToStr(timeident,0); 
//Creating objects, indicating their location
info=DoubleToStr(f[30-i],0); //Forming a text line to be displayed
ObjectSetText(ident,info,6,"Arial", Black);} //Describing the display format

To check the formed packages the program includes "The block of processing a strategy and placing the Main Flag". This block contains conditions providing which the EA must buy (if the Main Flag is equal to 1) and sell (if the Main Flag is equal to -1). If the described conditions are not fulfilled, the Main Flag stays equal to zero and trades are not executed. The EA also contains a block of position closing (it is commented).

if(f8==1&&f21==1) //Set of conditions, providing which Buy is executed
if(f8==-1&&f21==-1) //Set of conditions, providing which Sell is executed

Parameters of each indicator (oscillator) are described in the form of variables, which allows their automatic optimization (initial parameters are those generally accepted).


As said above, the offered Expert Advisor is not a ready automated trading system. Its main task is the conduct of a comparative analysis of indicators and oscillators for further formation of a package. The EA demonstrates signals produced by indicators not overloading a trader's desktop making the analysis very convenient.

The flexibility of the EA is in the following: a new set of indicators can be included into the matrix and formed packages can be tested on history data.

Translated from Russian by MetaQuotes Software Corp.
Original article:

Attached files |
Matrix.mq4 (32.39 KB)
Last comments | Go to discussion (14)
Michael | 21 May 2008 at 20:23

I have to add Bears into the "what's the point" section.  It's always getting set to 0.

if (iBullsPower(NULL,pibull,pibullu,PRICE_CLOSE,2)>0&&iBullsPower
f10=0; //Ïîêà íå èñïîëüçóåì
MQL4 Comments
MQL4 Comments | 21 May 2008 at 23:43

I have to add Bears into the "what's the point" section.  It's always getting set to 0.

if (iBullsPower(NULL,pibull,pibullu,PRICE_CLOSE,2)>0&&iBullsPower
f10=0; //Ïîêà íå èñïîëüçóåì

Would it not be possible (since the resulting matrix is known after calculation) to make another pass through the data and mark via color codes or some other graphic scheme the data much as has been marked up above in the description above?  It would greatly help those with weak eyesight (like me).
Mehmet Bastem
Mehmet Bastem | 22 May 2008 at 00:43

Please translate English. Your article is Rusian language.


Thank You.  but  expert advisor BUY or SELL not work. Order Send Error=131

Please Help Me ?



MisterH | 23 May 2008 at 22:04

Definitely one of the better ideas on this site. Keep up the good work.

Jose | 28 Dec 2008 at 02:09

I have download and save under expert folder.

The system takes long time working and nothing is show on the main window. I have check with diferent colour (black, yellow) and size fonts on the ObjectSetText function.

I have check on weekend, so there is no live market. Is this the reason?

I have change also distance=12 due ODL needs minimum of 10.

Also checked with 'strategy test' and nothing appear!!!

Can some one give some help?

Many thanks

Step on New Rails: Custom Indicators in MQL5 Step on New Rails: Custom Indicators in MQL5

I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.

Here Comes the New MetaTrader 5 and MQL5 Here Comes the New MetaTrader 5 and MQL5

This is just a brief review of MetaTrader 5. I can't describe all the system's new features for such a short time period - the testing started on 2009.09.09. This is a symbolical date, and I am sure it will be a lucky number. A few days have passed since I got the beta version of the MetaTrader 5 terminal and MQL5. I haven't managed to try all its features, but I am already impressed.

Portfolio trading in MetaTrader 4 Portfolio trading in MetaTrader 4

The article reveals the portfolio trading principles and their application to Forex market. A few simple mathematical portfolio arrangement models are considered. The article contains examples of practical implementation of the portfolio trading in MetaTrader 4: portfolio indicator and Expert Advisor for semi-automated trading. The elements of trading strategies, as well as their advantages and pitfalls are described.

False trigger protection for Trading Robot False trigger protection for Trading Robot

Profitability of trading systems is defined not only by logic and precision of analyzing the financial instrument dynamics, but also by the quality of the performance algorithm of this logic. False trigger is typical for low quality performance of the main logic of a trading robot. Ways of solving the specified problem are considered in this article.