Order Selective Delete MT4
- Utilities
- Francisco Manuel Vicente Berardo
- Version: 1.2
- Updated: 5 October 2024
The Order Selective Delete is a multi-symbol multi-timeframe script used to delete simultaneously various pending orders.
General Description
The Order Selective Delete possesses three operation modes (Intersection, Union and All) that control the way as three pending order features (symbol, magic number and type) are used. The modes, available through the Selection Mode input parameter, relate to the features, available through the “Select by Feature” and “Feature” input parameters, as follows:
- Intersection – contains only the pending orders whose features match all the features opted in the script.
- Union – contains all the pending orders whose features match at least a feature opted in the script.
- All – contains all the pending orders, regardless of any feature opted or not in the script.
The Intersection and Union operations in the script are similar to those in set theory, with the features selection and feature values representing the sets and set elements, respectively.
To use a given feature in the Intersection and Union modes, the respective “Select by Feature” needs to be activated, and the “Feature” needs to be selected with the intended value, except in the Select by Symbol case, whose value is always the chart’s symbol where the script is executed.
As an example of the script’s operation modes, consider four pending orders with different features and all the 3 modes with the same features setting (the type isn’t used):
Order 1 | Order 2 | Order 3 | Order 4 | Each mode | |
---|---|---|---|---|---|
Symbol | AUDUSD | USDJPY | GBPUSD | USDJPY | USDJPY |
Magic | 14758 | 32978 | 67389 | 90336 | 32978 |
Type | Buy Limit | Buy Limit | Sell Stop | Sell Limit | -------------- |
Each mode determines the following pending orders to delete: Intersection – order 2, Union – orders 2 and 4, and All – orders 1 to 4.
Input Parameters
- Selection Mode: Pending orders’ selection mode – Intersection/Union/All (see the General Description section above).
- Select by Symbol: Selection based on the pending order symbol.
- Select by Magic: Selection based on the pending order magic number.
- Select by Type: Selection based on the pending order type.
- Magic: Pending order magic number.
- Type: Pending order type.
Some of the available parameters accept values that lead to particular options.
- Select by Symbol, Select by Magic and Select by Type: The “true” value at just one of these parameters means that the Intersection and Union modes coincide.
- Magic: A null value means the pending orders placed manually or automatically with the 0-default value.
Displayed Information
The script possesses a few messages to inform the user about errors that might occur during its execution. The messages are shown through the Alert function (by a pop-up window), its content includes:
- The warning that an input parameter has been incorrectly set.
- The Trade Server Return Codes description.
- The symbol’s quotes (immediately) before the trade request’s formation, followed by the symbol’s quotes (immediately) after the trade server’s decision (only relevant to the programmer).
- The Runtime Errors description.
- The standard function in the include file where the runtime error was detected (only relevant to the programmer).
Note: Some elements of the list are displayed simultaneously (in the same text line): 2 and 3; 4 and 5.
Conclusion
The Order Selective Delete is a helpful and effective tool regarding the manual deletion of pending orders, especially when these reach a significant number, enabling a simple and intuitive selection of the orders to delete.