Problem with Yesterday date (iLowest, iHighest)

 
Now I'm using an indicator (MQL4) that count bars (timeframe 5 minutes) from the Top or Low within a range of x bars (in the example 215) with this formula:

int lowbar = iLowest(Symbol(), PERIOD_M5, MODE_LOW,215,1);
int highbar = iHighest(Symbol(), PERIOD_M5, MODE_HIGH,215,1);
datetime HighestTime=Time[highbar];
datetime LowestTime=Time[lowbar]; 

dstart=LowestTime;
or
dstart=HighestTime;
...

I want to modify this indicator by changing the count from from the Top or Low within a range of x bars to Yesterday's High or Low bars. I used iHigh and iLow to obtain this, but the indicator return wrong results. I'm a newbie so I made surely some errors.
Can you help me about this? Thanks in advance for your cooperation.
Regards.
 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. int lowbar = iLowest(Symbol(), PERIOD_M5, MODE_LOW,215,1);
    int highbar = iHighest(Symbol(), PERIOD_M5, MODE_HIGH,215,1);
    datetime HighestTime=Time[highbar];
    datetime LowestTime=Time[lowbar];
    You are mixing apples and oranges.
 
I appreciated your suggestion, but don't help me. I apologize for the posted code incorrectly.
 
Billyblu68: I appreciated your suggestion, but don't help me.
I did help you, but apparently you can't be bothered to click on links and learn.
 
You must get first and last of yesterday candle in M5 time frame and at this scope get maximum or minimum of variable that need.
Read iBarShift() function help and use this function for get first and last candle of M5 in yesterday .


Reason: