How to choose the date for yesterday in mql4

 
datetime ends=yesterday;
 

This is a general question, or may be I didn't understand it clearly! ... Please make it specific or describe your case to get the right answer.

Meantime, this could help ...

I use this into my EAs for expiry period ...

datetime Expiry = D'2015.12.21 23:59';
.....
.....
.....
if(TimeCurrent()>Expiry){
   ..... 
   .....
   .....
   return(0);
}

 So, you may use same idea by changing the desired end time.

 
Osama Shaban:

This is a general question, or may be I didn't understand it clearly! ... Please make it specific or describe your case to get the right answer.

Meantime, this could help ...

I use this into my EAs for expiry period ...

 So, you may use same idea by changing the desired end time.

thank you brother for helping
but i want to change Expiry to yesterday automatically
 

Potential code

    datetime yesterday = TimeCurrent() - 60 * 60 * 24;
    string time_yyyy_MM_dd = TimeToString(yesterday, TIME_DATE);
    Print("Yesterday=", StringToTime(time_yyyy_MM_dd));
 

Other example.

// Date of yesterday
//------------------
   datetime DayTimeBars[]; // Array for time/date value.
   CopyTime(Symbol(), PERIOD_D1, 1, 1, DayTimeBars); // Copy the time/date of the previous bar/day to array.
   
   Alert("The date of yesterday = ", DayTimeBars[0]);
Reason: