Русский

Справочник MQL4 Операции с массивами ArrayIsSeries

Справка MQL4 одним файлом:

ArrayIsSeries

Проверяет, является ли массив таймсерией.

bool  ArrayIsSeries(
   const void&  array[]    // проверяемый массив
   );

Параметры

array[]

[in]  Проверяемый массив.

Возвращаемое значение

Возвращается true, если проверяемый массив является массивом-таймсерией, иначе возвращается false. Массивы, передаваемые в качестве параметра функции OnCalculate(), необходимо проверять на порядок доступа к элементам массива функцией ArrayGetAsSeries().

Пример:

#property indicator_chart_window
#property indicator_buffers 1
//---- plot Label1
#property indicator_label1  "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- indicator buffers
double         Label1Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA);
//---
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   if(ArrayIsSeries(open))
      Print("open[] is timeseries");
   else
      Print("open[] is not timeseries!!!");
//--- return value of prev_calculated for next call
   return(rates_total);
  }

Смотри также

Доступ к таймсериям и индикаторам