GetBar()

定義

最も古いバーから最も新しいバーに向かって調べ、DateTimeパラメーターで渡されたタイム・スタンプに一致する最初のバーのインデックス番号を返す。

プロパティ値

バーのインデックス番号を表す int 型の値

構文

Bars.GetBar( DateTime time )

引数

time バーのインデックス番号に変換されるタイム・スタンプ

// Check that its past 9:45 AM
if (ToTime(Time[0]) >= ToTime(9, 45, 00))
{
     // Calculate the bars ago value for the 9 AM bar for the current day
     int barsAgo = CurrentBar - Bars.GetBar(new DateTime(2006, 12, 18, 9, 0, 0));
 
     // Print out the 9 AM bar closing price
     Print("The close price on the 9 AM bar was: " + Close[barsAgo].ToString());
}
最終更新:2014年06月12日 20:22