ArrayIsSeries

检测时间序列数组的函数。

bool  ArrayIsSeries(
   const void&  array[]    // 已经检测的数组
   );

参量

array[]

[in]  检测数组

返回值

如果检测数组是时序列返回真值,否则返回错误值。数组以参量形式传递到OnCalculate()函数一定通过 ArrayGetAsSeries()检测访问数组元素命令

示例:

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//---- 标签图1
#property indicator_label1  "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- 指标缓冲区
double         Label1Buffer[];
//+------------------------------------------------------------------+
//| 自定义指标初始化函数                                                |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- 指标缓冲区绘图
   SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA);
//---
  }
//+------------------------------------------------------------------+
//| 自定义指标重复函数                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   if(ArrayIsSeries(open))
      Print("open[] is timeseries");
   else
      Print("open[] is not timeseries!!!");
//--- 为下次调用返回prev_calculated值
   return(rates_total);
  }

另见

接入时间序列和指标