Thanks for that, I hadn't thought of that and it will make life easier for me. I'm going to use that next time I kick-start it.
Here's a uncompiled version of a close all trades EA that I found on the web at
http://www.iexpertadvisor.com/freemqlcode.asp