CloseOrders version 1.0 is a script that allows you to close all the specified orders with only a few clicks. It could save you from disaster in some cases and if you are learning MQL4 it could teach you some tricks.
There may be circumstances where you need to quickly close all of your orders, these may include:
- Unexpected events like wars, terroristic attacks, natural disasters
- News release, these may be unexpected and trigger sudden market changes, or they may be scheduled but you want to play safe with no open orders
- Personal emergencies of any type
In the above cases you would need to rush closing all your orders and if there are many open it may take a while. The script CloseOrders v1.0 can speed up the process for you.
You can download the script for educational purposes and test it on a Demo Account.
CloseOrders accepts a few parameters so that you can close all of the order or filter only some of them.
The parameters accepted are:
- Close only instrument in the chart, to select if close all of the orders or only the one matching the instrument (stock, index, currency pair) of the chart where the script is run
- Close only orders in profit, no need for explanation
- Close only orders in loss, quite clear
- Close only orders matching the magic number, can be true or false if you want to limit the selection to only orders with a specific magic number
- Matching magic number, if the above is true you need to specify a magic number
- Close only orders with the following comment, can be true or false, same as the magic number
- Matching comment, to specify the comment to look for if the above is true
- Slippage, in pips
- Delay to wait between closing orders (in milliseconds), if you want to set a wait time before the next close, may be necessary with some brokers or systems
The script is free to download and use.
Please leave a comment if you have any feedback or doubt and remember to like us on Social Media!
I would really appreciate also suggestions for improvements and reports of any bug found. Thank you!