Order Expiry

 
The help file provided does not show examples on using order expiry in the OrderSend() function.
I need to cancel all outstanding orders at midnight next business day.
 
use time as secinds for expiry
formulation of secinds time for midnite next busyness day and use it as epiry time in OrderSend(), ok.
 
Example:
int stopHour=0;
int StopMinute=0;

datetime [b]stopTime[/b]=StrToTime(StringConcatenate(Year(),".",Month(),".",Day()+1," ",stopHour,":",StopMinute));

int lifeTime=stopTime-TimeCurrent();
OrderSend(Symbol(),OP_BUYLIMIT,0.1,Ask-50*Point,Slippage.0,0,StringConcatenate("pending order for ",lifeTime," seconds"),0,[b]stopTime[/b],Blue);
 
Thanks Rosh,

Day()+1 from your example above gives me the current date somehow.