myeatrade

MQL4 Reference

MQL4 Technical indicators (2)

A group of functions intended for calculation of standard and custom indicators.

For an expert (or any other MQL4 program) to take up the value of any indicator, it is not necessary that this indicator is present in the chart. The requested indicator will be loaded and calculated in the thread of the module that has called it.

Any indicator can be calculated on the data of not only current chart, but also on the data of any available symbol/period. If data (symbol name and/or timeframe differ from the current ones) are requested from another chart, the situation is possible that the corresponding chart was not opened in the client terminal and the necessary data must be requested from the server. In this case, error ERR_HISTORY_WILL_UPDATED (4066 – the requested history data are under updating) will be placed in the last_error variable, and one will has to re-request (see example of ArrayCopySeries()).

 

iBullsPower()

double iBullsPower(string symbol, int timeframe, int period, 
                   int applied_price, int shift)

Calculates the Bulls Power indicator and returns its value.

Parameters:

symbol        - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
timeframe     - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
period        - Averaging period for calculation. 
applied_price - Applied price. It can be any of Applied price enumeration values.  
shift         - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double val=iBullsPower(NULL, 0, 13,PRICE_CLOSE,0);

iCCI()

double iCCI(string symbol, int timeframe, int period, 
            int applied_price, int shift)

Calculates the Commodity channel index and returns its value.

Parameters:

symbol        - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
timeframe     - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
period        - Averaging period for calculation. 
applied_price - Applied price. It can be any of Applied price enumeration values.  
shift         - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  if(iCCI(NULL,0,12,PRICE_TYPICAL,0)>iCCI(NULL,0,20,PRICE_TYPICAL,0)) return(0);

iCCIOnArray()

double iCCIOnArray(double array[], int total, int period, int shift)

Calculation of the Commodity Channel Index on data stored in a numeric array. Unlike iCCI(…), the iCCIOnArray function does not take data by symbol name, timeframe, the applied price. The price data must be previously prepared. The indicator is calculated from left to right. To access to the array elements as to a series array (i.e., from right to left), one has to use the ArraySetAsSeries function.

Parameters:

array[] - Array with data. 
total   - The number of items to be counted. 
period  - Averaging period for calculation.   
shift   - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  if(iCCIOnArray(ExtBuffer,total,12,0)>iCCI(NULL,0,20,PRICE_TYPICAL, 0)) return(0);

iCustom()

double iCustom(string symbol, int timeframe, string name, 
               ..., 
               int mode, int shift)

Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\experts\indicators directory.

Parameters:

symbol    - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
name      - Custom indicator compiled program name. 
...       - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator. 
mode      - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions.  
shift     - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double val=iCustom(NULL, 0, "SampleInd",13,1,0);

iDeMarker()

double iDeMarker(string symbol, int timeframe, int period, int shift)

Calculates the DeMarker indicator and returns its value.

Parameters:

symbol        - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
timeframe     - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
period        - Averaging period for calculation.   
shift         - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double val=iDeMarker(NULL, 0, 13, 1);

iEnvelopes()

double iEnvelopes(string symbol, int timeframe, int ma_period, 
                  int ma_method, int ma_shift, int applied_price, 
                  double deviation, int mode, int shift)

Calculates the Envelopes indicator and returns its value.

Parameters:

symbol        - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
timeframe     - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
ma_period     - Averaging period for calculation of the main line. 
ma_method     - MA method. It can be any of Moving Average method enumeration value. 
ma_shift      - MA shift. Indicator line offset relate to the chart by timeframe. 
applied_price - Applied price. It can be any of Applied price enumeration values. 
deviation     - Percent deviation from the main line. 
mode          - Indicator line index. It can be any of Indicators line identifiers enumeration value. 
shift         - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double val=iEnvelopes(NULL, 0, 13,MODE_SMA,10,PRICE_CLOSE,0.2,MODE_UPPER,0);

iEnvelopesOnArray()

double iEnvelopesOnArray(double array[], int total, int ma_period, 
                         int ma_method, int ma_shift, double deviation, 
                         int mode, int shift)

Calculates the Envelopes indicator and returns its value.

Parameters:

array[]   - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. 
total     - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
ma_period - Averaging period for calculation of the main line. 
ma_method - MA method. It can be any of Moving Average method enumeration value. 
ma_shift  - MA shift. Indicator line offset relate to the chart by timeframe. 
deviation - Percent deviation from the main line. 
mode      - Indicator line index. It can be any of Indicators line identifiers enumeration value. 
shift     - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double val=iEnvelopes(NULL, 0, 13,MODE_SMA,10,PRICE_CLOSE,0.2,MODE_UPPER,0);
This article url: http://www.myeatrade.com/453/

Please login to post comment, if you haven't account you can register free