CloseAllOrders.mq4 can close all or only the selected orders, set the parameters and run it.
Once you download the script you need to:
- Copy the mq4 file in the Metatrader data folder > MQL4 > Scripts
- Open the file with Metaeditor
- Compile the file
- Restart Metatrader
- The Script can now be run
If you are interested in building your own Expert Advisor or know more about how to do it check my MT4 Expert Advisor Template.