ArrayIsSeries

この関数は配列が時系列であるかどうかをチェックします。

bool  ArrayIsSeries(
  const void&  array[]   // チェックされた配列
  );

パラメータ

array[]

[in]  チェックされた配列

戻り値

チェックされた配列が時系列の場合は true、それ以外の場合は false を返します。OnCalculate() 関数にパラメータとして渡された配列は ArrayGetAsSeries() によって要素アクセスの順序をチェックしれなければいけません。

例:

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//---- Label1 をプロットする
#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);
 }

参照

時系列と指標へのアクセス