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:

Buy Stop — Order Placed Above Price and Triggered When Price Rises

Buy Stop — Order Placed Above Price and Triggered When Price Rises

Buy Limit — Order Placed Below Price and Triggered When Price Goes Down

Buy Limit — Order Placed Below Price and Triggered When Price Goes Down

Sell Stop — Order Placed Below Price and Triggered When Price Falls

Sell Stop — Order Placed Below Price and Triggered When Price Falls

Sell Limit — Order Placed Above Price and Triggered When Price Rises

Sell Limit — Order Placed Above Price and Triggered When Price Rises

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.

Selecting Pending Order Type in MT4

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.

Setting Up Multiple Pending Orders for Breakout Trading

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.

Delete Pending Orders Script - Input Parameters

Download MT4 Delete All Pending Script

The script is available for free download:

➥ Download Delete All Pending Script

MT4 Delete All Pending Script Installation

To install the script, please follow the instructions below:

  1. Download the script archive file.
  2. Open the MetaTrader 4 data folder (via File→Open Data Folder).
  3. Open the MQL4 Folder.
  4. Copy all the folders from the archive directly to the MQL4 folder.
  5. 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.

How to Enable Live Trading for Scripts in MT4?

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.

© 2005–2021

EarnForex.com

Design — Mart Studio

Forex trading bears intrinsic risks of loss. You must understand that Forex trading, while potentially profitable, can make you lose your money. Never trade with the money that you cannot afford to lose! Trading with leverage can wipe your account even faster.

CFDs are leveraged products and as such loses may be more than the initial invested capital. Trading in CFDs carry a high level of risk thus may not be appropriate for all investors.