MQL4 Reference Timeseries and Indicators Access iHighest

iHighest

Returns the shift of the maximum value over a specific number of bars depending on type.

int  iHighest(
   string           symbol,          // symbol
   int              timeframe,       // timeframe
   int              type,            // timeseries
   int              count,           // cont
   int              start            // start
  );

Parameters

symbol

[in]  Symbol the data of which should be used for search. NULL means the current symbol.

timeframe

[in]  Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.

type

[in]  Series array identifier. It can be any of the Series array identifier enumeration values.

count=WHOLE_ARRAY

[in]  Number of bars (in direction from the start bar to the back one) on which the search is carried out.

start=0

[in]  Shift showing the bar, relative to the current bar, that the data should be taken from.

Returned value

The shift of the maximum value over a specific number of bars or -1 if error. To check errors, one has to call the GetLastError() function.

Example:

  double val;
//--- calculating the highest value on the 20 consecutive bars in the range
//--- from the 4th to the 23rd index inclusive on the current chart
   int val_index=iHighest(NULL,0,MODE_HIGH,20,4);
   if(val_index!=-1) val=High[val_index];
   else PrintFormat("Error in call iHighest. Error code=%d",GetLastError());