myeatrade

MQL4 Reference

MQL4 Technical indicators (3)

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

 

iForce()

double iForce(string symbol, int timeframe, int period, int ma_method, 
              int applied_price, int shift)

Calculates the Force 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.
ma_method     - MA method. It can be any of Moving Average method enumeration value.  
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=iForce(NULL, 0, 13,MODE_SMA,PRICE_CLOSE,0);

iFractals()

double iFractals(string symbol, int timeframe, int mode, int shift)

Calculates the Fractals 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.   
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:

  double val=iFractals(NULL, 0, MODE_UPPER, 3);

iGator()

double iGator(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)

Gator oscillator calculation. The oscillator displays the difference between the Alligator red and blue lines (the upper histogram) and that between red and green lines (the lower histogram).

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=iGator(NULL, 0, 13, 8, 8, 5, 5, 3, MODE_SMMA, PRICE_MEDIAN, MODE_UPPER, 1);

iIchimoku()

double iIchimoku(string symbol, int timeframe, int tenkan_sen, 
                 int kijun_sen, int senkou_span_b, int mode, 
                 int shift)

Calculates the Ichimoku Kinko Hyo 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. 
tenkan_sen    - Tenkan Sen averaging period. 
kijun_sen     - Kijun Sen averaging period. 
senkou_span_b - Senkou SpanB averaging period. 
mode          - Source of data. It can be one of the Ichimoku Kinko Hyo mode enumeration.  
shift         - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). 

Sample:

  double tenkan_sen=iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1);

iBWMFI()

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

Calculates the Bill Williams Market Facilitation 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.  
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=iBWMFI(NULL, 0, 0);

iMomentum()

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

Calculates the Momentum 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:

  if(iMomentum(NULL,0,12,PRICE_CLOSE,0)>iMomentum(NULL,0,20,PRICE_CLOSE,0)) return(0);

iMomentumOnArray()

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

Calculation of the Momentum indicator on data stored in a numeric array. Unlike iMomentum(…), the iMomentumOnArray 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(iMomentumOnArray(mybuffer,100,12,0)>iMomentumOnArray(mubuffer,100,20,0)) return(0);
This article url: http://www.myeatrade.com/454/

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