Barsオブジェクト中の現在のバーの番号を表す int 値を格納する配列を保持する。独自のインジケーターあるいはストラテジー中でAdd()メソッドを呼び出した時、 int 値はこの配列に加えられる。その目的は、multi-instrumentやmulti-time frameのインジケーターあるいはストラテジーにおいて、全てのBarsオブジェクトのCurrentBarへのアクセス方法を提供することである。
int 値を格納する配列
CurrentBars[ int barSeriesIndex ]
protected override void Initialize()
{
// Adds a 5-minute Bars object to the script. It will automatically be assigned
// a Bars object index of 1 since the primary data the indicator is run against
// set by the UI takes the index of 0.
Add(Instrument, PeriodType.Minute, 5);
}
protected override void OnBarUpdate()
{
// Checks to make sure we have at least 20 (default value of BarsRequired)
// or more bars in both Bars objects before continuing.
if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired)
return;
// Script logic calculation code...
}