|
|
随机震荡指标随机震荡指标用于确定买卖信号。http://ta.mql4.com/indicators/oscillators/stochastic 函数原型:double iStochastic( string symbol, int timeframe, int %Kperiod, int %Dperiod, int slowing, int method, int price_field, int mode, int shift)
参数:交易品种 – 定义应该用于技术指标值计算的金融证券(货币对)。如果你需要当前(活动)的证券(图表),则使用 NULL(或 0)。时间范围 – 定义应该使用指标的时间范围(时长)。对当前时期使用 0 或以下常量之一(PERIOD_M1、PERIOD_M5、PERIOD_M15、PERIOD_M30、PERIOD_H1、PERIOD_H4、PERIOD_D1、PERIOD_W1、PERIOD_MN1)。%K period - 柱的数量,用于生成 %K 线。%D period - 柱的数量,用于生成 %D 线。slowing - 滚动值。method - 定义一种用于获取平均值的方法。选择一种方法有以下预定义的常量:
MODE_SMA - 简单移动平均线MODE_EMA - 指数移动平均线MODE_SMMA - 平滑移动平均线MODE_LWMA - 线性加权移动平均线
price_field – 定义什么价格应该用于计算。价格选择有以下预定义的值:
0 - 最低价/最高价1 - 收盘价/收盘价
mode - 定义要寻找的值。要进行选择,使用以下常量之一:
MODE_MAIN - 主线MODE_SIGNAL- 信号线
shift – 定义应该使用指标的柱。
使用 mode 参数,定义应返回的内容:

使用示例:
double s; s=iStochastic(0,0,10,6,6,MODE_SMA,0,MODE_MAIN,0);
// value of the main line for the last bar on the current chart and period. // Bars used to calculate lines %K, %D and slowing // accordingly: 10, 6 and 6. Method of averaging: simple moving average. // Use prices: Low/High.
s=iStochastic("EURUSD",PERIOD_M1,6,3,3,MODE_SMMA,1,MODE_SIGNAL,1);
// value of the signal line for the last but one bar on a minute chart EURUSD.// Bars used to calculate lines %K, %D and slowing // accordingly: 6, 3 and 3. Method of averaging: smoothed moving average. // Use prices: Close/Close.
s=iStochastic("EURGBP",PERIOD_M5,9,7,7,MODE_EMA,0,MODE_MAIN,0);// value of the main line for the last bar on 5-minute chart EURGBP.
// Bars used to calculate lines %K, %D and slowing // accordingly: 9, 7 and 7. Method of averaging: exponential moving average.// Use prices: Low/High.
复制代码 |
|