If you want to know how to delete pending orders with an expiration time, here is an interesting thread on mql4 :

Error on limit order expiration. - MQL4 forum