BarsCalculated

指定された指標の計算されたデータ数を返します。

int  BarsCalculated(
  int      indicator_handle,    // 指標ハンドル
  );

パラメータ

indicator_handle

[in]  対応する指標関数によって戻された指標ハンドル

戻り値

指標バッファで計算されたデータの量。エラーの場合(データはまだ計算されていない)-1 。

注意事項

この関数は、作成後すぐに指標データを取得することが必要な場合に便利です(指標ハンドルが利用可能)。

例:

void OnStart()
 {
  double Ups[];
//--- 配列に時系列の索引付けを設定する
  ArraySetAsSeries(Ups,true);
//--- フラクタル指標のハンドルを作成する
  int FractalsHandle=iFractals(NULL,0);
//--- エラーコードをリセットする
  ResetLastError();
//--- 指標値をコピーを試みる
  int i,copied=CopyBuffer(FractalsHandle,0,0,1000,Ups);
  if(copied<=0)
    {
    Sleep(50);
    for(i=0;i<100;i++)
       {
        if(BarsCalculated(FractalsHandle)>0)
          break;
        Sleep(50);
       }
     copied=CopyBuffer(FractalsHandle,0,0,1000,Ups);
    if(copied<=0)
       {
        Print("Failed to copy upper fractals. Error = ",GetLastError(),
        "i = ",i,"    copied = ",copied);
        return;
       }
      else
        Print("Upper fractals copied",
        "i = ",i,"    copied = ",copied);
    }
  else Print("Upper fractals copied. ArraySize = ",ArraySize(Ups));
 }