myeatrade

MQL4 Reference

MQL4 Technical indicators (1)

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()).

 

iAC()

double iAC(string symbol, int timeframe, int shift)

Calculates the Bill Williams’ Accelerator/Decelerator oscillator.

Parameters:

symbol    - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol. 
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
shift     - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double result=iAC(NULL, 0, 1);

iAD()

double iAD(string symbol, int timeframe, int shift)

Calculates the Accumulation/Distribution indicator and returns its value.

Parameters:

symbol    - Symbol name of the security on the data of which the indicator will be calculated. NULL means the current symbol. 
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. 
shift     - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double result=iAD(NULL, 0, 1);

iAlligator()

double iAlligator(string symbol, int timeframe, 
                  int jaw_period, int jaw_shift, 
                  int teeth_period, int teeth_shift, 
                  int lips_period, int lips_shift, 
                  int ma_method, int applied_price, 
                  int mode, int shift)

Calculates the Bill Williams’ Alligator 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 one of Timeframe enumeration values. 0 means the current chart timeframe. 
jaw_period      - Blue line averaging period (Alligator's Jaw). 
jaw_shift       - Blue line shift relative to the chart. 
teeth_period    - Red line averaging period (Alligator's Teeth). 
teeth_shift     - Red line shift relative to the chart. 
lips_period     - Green line averaging period (Alligator's Lips). 
lips_shift      - Green line shift relative to the chart. 
ma_method       - MA method. It can be any of Moving Average methods. 
applied_price   - Applied price. It can be any of Applied price enumeration values. 
mode            - Data source, identifier of a line of the indicator. It can be any of the following values:
MODE_GATORJAW   - Gator Jaw (blue) balance line,
MODE_GATORTEETH - Gator Teeth (red) balance line,
MODE_GATORLIPS  - Gator Lips (green) balance line. 
shift           - Shift relative to the current bar (number of periods back) where the data should be taken from. 

Sample:

  double jaw_val=iAlligator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_GATORJAW, 1);

iADX()

double iADX(string symbol, int timeframe, int period, 
            int applied_price, int mode, int shift)

Calculates the Movement directional 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. 
mode          - Indicator line index. It can be any of the 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:

  if(iADX(NULL,0,14,PRICE_HIGH,MODE_MAIN,0)>iADX(NULL,0,14,PRICE_HIGH,MODE_PLUSDI,0)) return(0);

iATR()

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

Calculates the Indicator of the average true range 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:

  if(iATR(NULL,0,12,0)>iATR(NULL,0,20,0)) return(0);

iAO()

double iAO(string symbol, int timeframe, int shift)

Calculates the Bill Williams’ Awesome oscillator 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. 
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=iAO(NULL, 0, 2);

iBearsPower()

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

Calculates the Bears 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=iBearsPower(NULL, 0, 13,PRICE_CLOSE,0);

iBands()

double iBands(string symbol, int timeframe, int period, 
              int deviation, int bands_shift, int applied_price, 
              int mode, int shift)

Calculates the Bollinger Bands indicator and returns its value.

Parameters:

symbol        - Symbol the data of which should be used to calculate the 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 to calculate the main line. 
deviation     - Deviation from the main line. 
bands_shift   - The indicator shift relative to the chart. 
applied_price - Applied price. It can be any of Applied price enumeration values. 
mode          - Indicator line index. It can be any of the 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:

  if(iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0)>Low[0]) return(0);

iBandsOnArray()

double iBandsOnArray(double array[], int total, int period, 
                     int deviation, int bands_shift, int mode, 
                     int shift)

Calculation of the Bollinger Bands indicator on data stored in a numeric array. Unlike iBands(…), the iBandsOnArray 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. 0 means the whole array. 
period      - Averaging period to calculate the main line. 
deviation   - Deviation from the main line. 
bands_shift - The indicator shift relative to the chart.  
mode        - Indicator line index. It can be any of the 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:

  if(iBandsOnArray(ExtBuffer,total,2,0,MODE_LOWER,0)>Low[0]) return(0);
This article url: http://www.myeatrade.com/452/

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