MQL4参考 预定义变量 Open

double Open[]

Series array that contains open prices of 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:

   i = Bars - counted_bars - 1;
   while(i>=0)
     {
      double high  = High[i];
      double low   = Low[i];
      double open  = Open[i];
      double close = Close[i];
      AccumulationBuffer[i] = (close-low) - (high-close);
      if(AccumulationBuffer[i] != 0)
        {
         double diff = high - low;
         if(0==diff)
            AccumulationBuffer[i] = 0;
         else
           {
            AccumulationBuffer[i] /= diff;
            AccumulationBuffer[i] *= Volume[i];
           }
        }
      if(i<Bars-1) AccumulationBuffer[i] += AccumulationBuffer[i+1];
      i--;
     }

See also

iOpen()