# Get time of High & Low since Open[8] ?

You sell neither signals nor apps? No problem, everyone can make profit!
169
2012.08.22 12:52

Hello everyone,

Please can I have some help with this coding problem. I need to assign values to 4 variables for further use in my simple EA.

double HighVal          //HighVal is the highest bid value since Open[8]

datetime HighTime    //HighTime is the time of the highest bid since Open[8]

double LowVal          //LowVal is the lowest bid value since Open[8]

datetime LowTime   //LowTime is the time of the lowest bid since Open[8]

Many thanks to you all.

39
2012.08.23 04:38

Hi,

`http://www.mql5.com/en/docs/standardlibrary/technicalindicators/timeseries`

It's very good place for you to started to solve this problem.

Cheers.

685
2012.08.23 14:26
Vos77:

Hello everyone,

Please can I have some help with this coding problem. I need to assign values to 4 variables for further use in my simple EA.

double HighVal          //HighVal is the highest bid value since Open[8]

datetime HighTime    //HighTime is the time of the highest bid since Open[8]

double LowVal          //LowVal is the lowest bid value since Open[8]

datetime LowTime   //LowTime is the time of the lowest bid since Open[8]

Many thanks to you all.

If I understand you properly, for the values you can use CopyHigh e.g. 1st variant of call:

```double targetArray[];
CopyHigh("EURUSD",PERIOD_M1,0,9,targetArray);```

and then ArrayMaximum to find the highest High value among the copied elements:

`int highIndex = ArrayMaximum(targetArray,0,WHOLE_ARRAY);`

So that you know that the highest value is in

`targetArray[highIndex]`

Then to get time of this bar:

```datetime timeArray[];
CopyTime("EURUSD",PERIOD_M1,highIndex,1,timeArray);```

And then you have time of the bar in

`timeArray[0]`

Obviously for the low values you use CopyLow and ArrayMinimum.

169
2012.08.24 01:42
Enigma71fx:

If I understand you properly, for the values you can use CopyHigh e.g. 1st variant of call:

and then ArrayMaximum to find the highest High value among the copied elements:

So that you know that the highest value is in

Then to get time of this bar:

And then you have time of the bar in

Obviously for the low values you use CopyLow and ArrayMinimum.

Thanks to you both,

That is what I was looking for. I also missed the code sample at the bottom of the CopyHigh page, which might be useful to me.

```//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
//--- at each tick we output the High and Low values for the bar with index,
//--- equal of the tick second
datetime t=TimeCurrent();
int sec=t%60;
printf("High[%d] = %G  Low[%d] = %G",
sec,iHigh(Symbol(),0,sec),
sec,iLow(Symbol(),0,sec));
}```