跳至内容

iCustom

iCustom

计算指定的自定义指标并返回其值。

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
   );

参数

symbol

[in] 要计算指标的数据上的符号名称。NULL表示当前符号。

timeframe

[in] 时间范围。可以是ENUM_TIMEFRAMES枚举值中的任何一种。0表示当前图表时间范围。

name

[in] 相对于根指标目录(MQL4/Indicators/)的自定义指标编译程序名称。如果指标位于子目录中,例如MQL4/Indicators/Examples中,其名称必须指定为“Examples\\indicator_name”(双反斜杠“\”必须作为分隔符使用,而不是单个斜杠)。

[in] 自定义指标的输入参数,用逗号分隔。

传递的参数及其顺序必须与自定义指标的外部变量的声明顺序和类型相符。如果输入参数的值未指定,将使用默认值

mode

[in] 行索引。可以是0到7之间的值,并且必须对应于SetIndexBuffer()函数调用中指定的索引。

shift

[in] 从指标缓冲区获取值的索引(相对于当前条形图向前移动给定周期数)。

返回值

指定自定义指标的数值。自定义指标必须已编译(*.EX4文件)并且位于terminal_directory\MQL4\Indicators\目录中。

示例:

double val=iCustom(NULL,0,"SampleInd",13,1,0);
最后更新于