# How to find the time when previous day high and low were made

330

Hey guys,

I need some help please. I am trying to look for the time when the previous day high and low was formed. Below are my equations; they do give the correct prices, however they do not return the correct integers of the candles that formed the high/ low. Please help!

```high=iHighest(NULL,0,MODE_HIGH,iBarShift(NULL,0,Time[0]-((Time[0]%86400)+86400),1));
low=iLowest(NULL,0,MODE_LOW,iBarShift(NULL,0,Time[0]-((Time[0]%86400)+86400),1));
timei=Time[low];
timeii=Time[high];```

Thank you!

15086

1. `Time[0]-((Time[0]%86400)+86400)`
This assumes that there are no gaps in the chart, like there are over the weekend. Don't assume.
2. `iHighest(NULL,0,MODE_HIGH,x,1)`
This returns the highest bar from [x-1 .. 1] That is not from [yesterday .. today)
3. Write self documenting code.
```#define HR2400 86400
datetime today     = Time[0] - Time[0] % HR2400;
int      iYestLast = iBarShift(NULL,0, today) - 1;
datetime yesterday = Time[iYestLast] - Time[iYestLast]  % HR2400;
int      iYestBeg  = iBarShift(NULL,0, yesterday);
int      len       = iYestBeg - iYestLast + 1;

high=iHighest(NULL,0,MODE_HIGH, len, iYestLast);
low=iLowest( NULL,0,MODE_LOW,  len, iYestLast);
timei=Time[low];
timeii=Time[high];```

330

WHRoeder:
1. This assumes that there are no gaps in the chart, like there are over the weekend. Don't assume.
2. This returns the highest bar from [x-1 .. 1] That is not from [yesterday .. today)
3. Write self documenting code.
Thank you good sir. Will give this a try.