# Highest High and Lowest Low for the Day

330

Hey guys,

I am in need of assistance please. What I would like to do is every time price creates a new high or low for the day I want to be able to save the price and the time somehow (perhaps in the global scope) to use it as a reference point? Would anyone know how to do this?

580

Hi Dean,

your algorithm should look like this for the highs:

• store the current highest high (at beginning of day, high of first bar)
• compare high of new candle with current highest high (https://docs.mql4.com/series/ihigh)
• if it is higher, memorize price and datetime, store new value for current highest high
• and so on until end of day

Hope this was of help. Have a nice Weekend!

175

Use:

`iHigh(NULL, PERIOD_D1, 0);`

and

`iLow(NULL, PERIOD_D1, 0);`

Store them to variables and compare the current to the stored to update / record what you want .

330

Paul_B:

Use:

and

Store them to variables and compare the current to the stored to update / record what you want .

Thank you for your reply. I did some digging and got this:

`int High=iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1); `

And modified it to get the high price:

``` double DailyHigh=High[iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1)];
```

Then used this to store the time:

```datetime DailyHighTime=Time[High];
```

However, how do I compare the current high price and time to those and store them?

580

DeanDeV:

However, how do I compare the current high price and time to those and store them?

I see your request was meant for daily charts, at first misunderstood you wanted to analyze smaller timeframes for every single day. Try this for comparation & update:

```if (High[0]>DailyHigh)
{
DailyHigh=High[0];
DailyHighTime=Time[0];
}
```