Delete All Pending Orders Script for MT4
Pending orders are an important aspect of Forex and trading in general. In fact, some strategies are actually entirely based on pending orders. Below, you will learn about pending orders and how to submit and delete multiple and opposite pending orders in MetaTrader. You will also be able to download a free open-source script to delete all pending orders in MT4 with just a few clicks.
What Are Pending Orders?
There are two main types of orders:
- Market orders
- Pending orders
Market orders are those orders that are immediately submitted to the broker and executed at the current market price.
Pending orders, on the other hand, are orders that are submitted to the broker but with the instruction to be executed at a specific price.
Pending orders are usually divided into four main subtypes:
- Buy Stop orders
- Buy Limit orders
- Sell Stop orders
- Sell Limit orders
The order is used depends on the trade direction, the entry price, and the current price.
These images demonstrate the differences between the four types of pending orders:
Pending Orders In MT4
MetaTrader platform is equipped to manage all four of the above-mentioned types of pending orders, but with some limitations.
If you wish to create a new pending order you can do so by creating a new order and selecting Pending Order.
Then you can select the type of pending order, the open price, and the optional stop-loss and take-profit levels.
To edit or delete a pending order, you can use the trade tab and manage the pending orders one by one.
One of the biggest limitations in MT4 for people who heavily use pending orders is that with MetaTrader, you can only update or delete one pending order at a time.
Why Open Opposite Buy/Sell Pending Orders
There are cases where traders need to open opposite pending orders at the same time. But why?
Having opposite positions open at the same time can be seen as hedging, or risk limitation, but this is not to be confused with opposite pending orders.
Opposite pending orders are like triggers, waiting for a condition to be verified in order for the order to execute.
Some strategies are based on having opposite pending orders open and ready to execute.
This is usually done when a strategy wants to take advantage of rapid price movements.
When the price moves quickly, a trade might not be fast enough to catch the move, while a pending order is always ready to trigger. In case the price action happens when the computer is unattended, having pending orders ready is a logical solution.
The following are examples of the use of multiple opposite buy/sell pending orders.
News Trading with Opposite Pending Orders
News are usually a cause for increased volatility in the market. Often before an important scheduled news, you can observe a decrease in volatility while waiting for the result of a report or the details of a news release.
In this case, news traders prefer to place opposite pending orders to catch the price movement once the news is released.
Breakout Trading with Opposite Pending Orders
Breakout trading is another popular strategy. When the price has been ranging for a while, traders start to expect a breakout.
Some traders then bet on the breakout and place opposite buy stop and sell stop orders at the edges of the range.
This way, they can catch the breakout right when it happens.
Pullback Trading with Opposite Pending Orders
Similar to the breakout strategy, a pullback strategy works in the opposite way.
When the price has been ranging for a while some traders might expect some further consolidation.
These traders then bet on the pullback of the price once it touches the edges, so they place opposite buy limit and sell limit orders at the edges of the range.
How to Open Opposite Buy/Sell Pending Orders in MT4?
As mentioned before, MT4 is unable to manage multiple pending orders concurrently through the graphical interface. However, there are tools that can help.
If you wish to have a way to submit opposite buy and sell pending orders at the same time, the following tool is the solution:
One Click Trading Pro EA for MetaTrader 4 can submit opposite orders with only one click.
You can decide the open price, the distance and other parameters.
How to Delete Multiple Pending Orders (Script)
As for deletion of multiple opposite buy/sell pending orders, MT4 cannot do it with only one click.
However, you can download this free simple script so you can delete opposite pending order in one click.
Available Parameters
The script supports a number of input parameters to help you filter pending orders that you wish to delete and also the deletion execution process.
MT4 Delete All Pending Script Installation
To install the script, please follow the instructions below:
- Download the script archive file.
- Open the MetaTrader 4 data folder (via File→Open Data Folder).
- Open the MQL4 Folder.
- Copy all the folders from the archive directly to the MQL4 folder.
- Restart MetaTrader 4 or refresh the list of scripts by right-clicking the Navigator subwindow of the platform and choosing Refresh.
You can also read a more detailed instruction on how to perform the installation.
Make sure you enable Allow live trading in the Common tab when executing this script and also in the platform's menu Tools→Options→Expert Advisors. Otherwise, it won't be able to delete a single pending order.
Conclusion
Pending orders are a powerful tool for traders, but in some cases MT4 limits their use. For advanced use, you can find the One Click Trade Pro, so you can open opposite buy sell pending orders at the same time.
If instead you want to delete multiple pending orders, you can download and use the script presented here.