Download MetaTrader 5

Comparative Analysis of 30 Indicators and Oscillators

20 May 2008, 11:32
3 066


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

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization

This article dwells on implementation algorithm of simplest trading systems. The article will be useful for beginning traders and EA writers.

Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning Metalanguage of Graphical Lines-Requests. Trading and Qualified Trading Learning

The article describes a simple, accessible language of graphical trading requests compatible with traditional technical analysis. The attached Gterminal is a half-automated Expert Advisor using in trading results of graphical analysis. Better used for self-education and training of beginning traders.

Fallacies, Part 1: Money Management is Secondary and Not Very Important Fallacies, Part 1: Money Management is Secondary and Not Very Important

The first demonstration of testing results of a strategy based on 0.1 lot is becoming a standard de facto in the Forum. Having received "not so bad" from professionals, a beginner sees that "0.1" testing brings rather modest results and decides to introduce an aggressive money management thinking that positive mathematic expectation automatically provides positive results. Let's see what results can be achieved. Together with that we will try to construct several artificial balance graphs that are very instructive.

Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Cont.) Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Cont.)

In this article the author continues to analyze implementation algorithms of simplest trading systems and describes some relevant details of using optimization results. The article will be useful for beginning traders and EA writers.