The Expert Advisor closes all the current symbol positions opened on the account, if the current server time has exceeded the time limit specified in the input variables.
//+----------------------------------------------+ //| Expert Advisor input parameters | //+----------------------------------------------+ input datetime StopTime=D'2030.01.01 23:59'; //Position closing time input uint Deviation_=20; //max price deviation in points