MQL4参考 预定义变量 Close

double Close[]

Series array that contains close prices for each bar of the current chart.

Series array elements are indexed in the reverse order, i.e., from the last one to the first one. The current bar which is the last in the array is indexed as 0. The oldest bar, the first in the chart, is indexed as Bars-1.

Example:

  int handle = FileOpen("file.csv"FILE_CSV|FILE_WRITE";");
  if(handle>0)
    {
     // table column headers recording
     FileWrite(handle, "Time;Open;High;Low;Close;Volume");
     // data recording
     for(int i=0; i<Bars; i++)
       FileWrite(handle, Time[i], Open[i], High[i], Low[i], Close[i], Volume[i]);
     FileClose(handle);
    }

See also

iClose()