MQL4 Reference Technical Indicators iCustom

iCustom

Calculates the specified custom indicator and returns its value.

double  iCustom(
   string       symbol,           // symbol
   int          timeframe,        // timeframe
   string       name,             // path/name of the custom indicator compiled program
   ...                            // custom indicator input parameters (if necessary)
   int          mode,             // line index
   int          shift             // shift
   );

Parameters

symbol

[in]  Symbol name on the data of which the indicator will be calculated. NULL means the current symbol.

timeframe

[in]  Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.

name

[in]  Custom indicator compiled program name, relative to the root indicators directory (MQL4/Indicators/). If the indicator is located in subdirectory, for example, in MQL4/Indicators/Examples, its name must be specified as "Examples\\indicator_name" (double backslash "\\"must be specified as separator instead of a single one).

...

[in]  Custom indicator input-parameters, separated by commas.

The passed parameters and their order must correspond with the declaration order and the type of extern variables of the custom indicator. If the values of input parameters  is not specified, the default values will be used.

mode

[in]  Line index. Can be from 0 to 7 and must correspond with the index, specified in call of the SetIndexBuffer() function.

shift

[in]  Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

Returned value

Numerical value of the specified custom indicator. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\MQL4\Indicators\ directory.

Example:

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