How to close /open trade using time.? Mql4 format
You can use OrderClose for that. see this for more info