Skip to main content

Pending Orders, OCO, and Opposite Orders Explained

Learn pending orders, OCO, opposite-order deletion, no-open-trades checks, multiple entries, and trailing-stop behavior. Understand when to use OCO, Delete Orders, Count Trades, Group Numbers, and Select Trades.

Use this article if you are confused about pending orders, OCO, “no open trades,” multiple entries, or deleting the opposite pending order.

This is a practical beginner guide. It explains what happens in the Builder and what usually goes wrong.

Also known as: pending order, buy pending order, sell pending order, OCO, one cancels other, delete opposite order, no open trades, Count Trades, multiple entries, buy stop, sell stop, buy limit, sell limit.


Summary

A pending order is not an open trade yet.

It waits at a price level.

Only when market price reaches that level does the pending order become an open trade.

Important:

  • Pending Order = waiting order

  • Open Trade = active position

  • Delete Orders = removes pending orders

  • Close Trades = closes open trades

  • OCO = automatically creates a mirrored opposite pending order

  • Count Trades = checks whether trades or orders already exist


What is a pending order?

A pending order is an order that waits for price to reach a specific level.

Example:

Current EURUSD price: 1.08500
Buy Pending Order level: 1.09000

The buy trade does not open immediately.

It only opens if price reaches 1.09000.


Buy Pending Order vs Sell Pending Order

There are two pending order blocks:

  • Buy Pending Order

  • Sell Pending Order

Use Buy Pending Order when the future trade should be a buy. Use Sell Pending Order when the future trade should be a sell. There is no separate dropdown where you choose Buy Limit, Buy Stop, Sell Limit, or Sell Stop. The Builder decides the behavior from:

  1. the block you choose

  2. the Open Price Level you set

Simple examples:

  • Buy Pending Order above current price = buy breakout style

  • Buy Pending Order below current price = buy pullback style

  • Sell Pending Order below current price = sell breakout style

  • Sell Pending Order above current price = sell pullback style


What does OCO mean?

OCO means One Cancels Other. When OCO is enabled on a pending order block, the EA automatically creates a mirrored opposite pending order. If one order gets triggered, the other pending order is deleted automatically.

Example:

You place a Buy Pending Order 20 pips above current price with OCO enabled.

The EA also places a mirrored Sell Pending Order 20 pips below current price.

If the buy order triggers, the sell pending order is deleted.

If the sell order triggers, the buy pending order is deleted.


What OCO does not do

OCO does not link two separate custom pending orders that you manually created.

This is the most important point.

If you create:

  • Buy Pending Order at Candle High ID 1 + 18 pips

  • Sell Pending Order at Candle Low ID 1 - 18 pips

those are two separately defined orders. The built-in OCO option is not designed to link those two custom orders. OCO mirrors one pending order around the current price. It does not automatically say:

“Use my custom buy level and my custom sell level and link them together.”


When should you use OCO?

Use OCO when you want a simple mirrored breakout setup.

Example:

Price is in the middle. You want one pending order above price and one mirrored pending order below price. If one side triggers, the other side should be removed.

Good use case:

Breakout above or below the current market area.


When should you not use OCO?

Do not use the built-in OCO option when you want two independently defined pending orders.

Example:

Buy Pending Order:

  • Open Price: Candle High ID 1 + 18 pips

  • Stop Loss: 40 pips

  • Take Profit: 20 pips

Sell Pending Order:

  • Open Price: Candle Low ID 1 - 18 pips

  • Stop Loss: 40 pips

  • Take Profit: 20 pips

In this case, you are not asking the EA to mirror one order.

You are defining two separate pending orders.

For that setup, build custom delete logic with Select Trades and Delete Orders.


How to delete the opposite pending order after one side triggers

Goal:

You place one buy pending order and one sell pending order.

When one pending order gets triggered and becomes an open trade, the other pending order should be deleted.

Use this structure:

Entry tree

Run at Time / Run per Candle
→ Count Trades
→ Buy Pending Order
→ Sell Pending Order

This places both pending orders.

Best practice:

Use different Group Numbers.

Example:

  • Buy Pending Order = Group 1

  • Sell Pending Order = Group 2

This makes it easier to select and delete the correct order later.


Delete sell pending order after buy triggers

Run per Tick
→ Count Trades: open buy trades in Group 1 > 0
→ Select Trades: pending sell orders in Group 2
→ Delete Orders

Plain English:

If the buy order has triggered and there is now an open buy trade, delete the still-waiting sell pending order.


Delete buy pending order after sell triggers

Run per Tick
→ Count Trades: open sell trades in Group 2 > 0
→ Select Trades: pending buy orders in Group 1
→ Delete Orders

Plain English:

If the sell order has triggered and there is now an open sell trade, delete the still-waiting buy pending order.


Important: blocks after a pending order do not wait

This is a common misunderstanding.

If you build:

Buy Pending Order
→ Select Trades
→ Delete Orders

the blocks after Buy Pending Order do not wait until the pending order gets triggered.

They run immediately after the pending order is placed.

So do not place Delete Orders directly after Buy Pending Order if your intention is:

“Wait until the buy order triggers, then delete the sell order.”

That needs a separate management tree.

Use:

Run per Tick
→ Count Trades: open buy trade exists
→ Select Trades: opposite pending order
→ Delete Orders


What does “no open trades” mean?

“No open trades” usually means a Count Trades block checks whether the number of matching open trades is zero.

Example:

Count Trades: open trades = 0

Plain English:

Only continue if there are no matching open trades.

This is often used before opening a new trade or placing a pending order.

Example:

Run per Candle
→ Trade Rule
→ Count Trades: open trades = 0
→ Buy Pending Order

This prevents the EA from placing new orders while a trade is already open.


Open trades vs pending orders

Be precise here.

An open trade is an active position.

A pending order is still waiting.

If you only check “open trades = 0,” there may still be pending orders waiting.

If you want to prevent repeated pending orders, make sure your Count Trades logic also considers pending orders where needed.

Simple rule:

  • To prevent duplicate open trades, count open trades.

  • To prevent duplicate pending orders, count pending orders.

  • To prevent both, count both or add separate checks.


Multiple entries with pending orders

If you want multiple entries from the same setup, use separate branches and Group Numbers.

Example:

Entry 1:

  • Buy Pending Order

  • Group 1

  • Take Profit 10 pips

Entry 2:

  • Buy Pending Order

  • Group 2

  • Take Profit 20 pips

Use Group Numbers so you can manage them separately later.

Example:

Select Trades: Group 1
→ manage TP1 trade

Select Trades: Group 2
→ manage TP2 trade

If both entries should be allowed to exist, do not use one broad Count Trades check that blocks the second entry after the first one is placed.


Trailing stops and pending orders

Trailing stops do not manage pending orders. A trailing stop manages an open trade. That means the pending order must trigger first. Then the management logic can start.

Example:

Run per Tick
→ Select Trades: open buy trades
→ Check Profit/Loss: profit >= 10 pips
→ Modify SL/TP

Plain English:

Once the pending order becomes an open trade and reaches 10 pips profit, the EA starts modifying the stop loss. If your strategy can open both buy and sell trades, you may need separate management trees:

Buy management:

Run per Tick
→ Select Trades: open buy trades
→ Check Profit/Loss
→ Modify SL/TP

Sell management:

Run per Tick
→ Select Trades: open sell trades
→ Check Profit/Loss
→ Modify SL/TP

Buy and sell trailing logic often need different stop-loss direction settings.


Common mistakes

1. Using OCO for two custom orders

OCO mirrors one pending order.

It does not link two separately designed pending orders.

If you want custom buy and sell levels, use custom Delete Orders logic.


2. Deleting orders directly after placing them

Blocks after a pending order block run immediately.

They do not wait until the pending order triggers.

Use a separate management tree to delete the opposite pending order after one side becomes an open trade.


3. Confusing pending orders and open trades

Pending orders wait.

Open trades are active.

Use Delete Orders for pending orders.

Use Close Trades for open trades.


4. Forgetting Count Trades

Without Count Trades, the EA may place repeated pending orders.

Use Count Trades before your pending order blocks.


5. Checking only open trades when pending orders also matter

If you only check open trades, the EA may still place duplicate pending orders.

If your goal is “only one setup active,” check both open trades and pending orders where needed.


6. Trying to trail a stop loss before the order is triggered

A trailing stop works on open trades.

It does not trail a pending order before entry.

First the pending order must trigger. Then the trailing stop management can modify the open trade.


Best-practice structure

Simple pending order

Run per Candle
→ Trade Rule
→ Count Trades
→ Buy Pending Order / Sell Pending Order


OCO breakout setup

Run per Candle
→ Trade Rule
→ Count Trades
→ Buy Pending Order with OCO enabled

The EA creates the mirrored opposite pending order automatically.


Two custom opposite pending orders

Run per Candle / Run at Time
→ Count Trades
→ Buy Pending Order: Group 1
→ Sell Pending Order: Group 2

Then add separate delete logic:

Run per Tick
→ Count Trades: open buy Group 1 > 0
→ Select Trades: pending sell Group 2
→ Delete Orders

Run per Tick
→ Count Trades: open sell Group 2 > 0
→ Select Trades: pending buy Group 1
→ Delete Orders


Trailing after pending order triggers

Run per Tick
→ Select Trades: open trades
→ Check Profit/Loss
→ Modify SL/TP


Debug checklist

If your pending order setup does not work, check:

  1. Did the pending order actually get placed?

  2. Is it still pending, or did it already trigger?

  3. Are you using Delete Orders for pending orders?

  4. Are you using Close Trades for open trades?

  5. Is Count Trades blocking the order before it is placed?

  6. Are you accidentally deleting the order immediately after placing it?

  7. Are Group Numbers set correctly?

  8. Does Select Trades target the correct direction and order type?

  9. Are you using OCO for a mirrored setup or two custom orders?

  10. Did you test the setup in MT5 Visual Mode?


Conclusion

Pending orders wait for price. Open trades are active positions. OCO is useful when you want one mirrored opposite pending order to be created automatically. If you want two custom pending orders, one buy and one sell, and you want the untriggered one deleted after the other triggers, build that with Delete Orders logic.

The safest mental model is:

Place pending orders in the entry tree.

Manage or delete them in a separate management tree.

Trail stop losses only after a pending order becomes an open trade.

Did this answer your question?