Last updated: May 17, 2026
System Specs

OCO (One Cancels Other) Orders for News Trading

Trade-Charts IntelUpdate 2026.03

The Logic of the Simultaneous Stop: What is OCO?

An OCO (One Cancels Other) order is a pair of pending orders linked by a script or EA. If one order is triggered, the other is automatically deleted. This is a critical tool for traders who want to catch explosive breakouts without knowing which direction the market will move.

In a standard news-straddle strategy, you place a 'Buy Stop' above the current price and a 'Sell Stop' below it. Without OCO logic, you risk having the market trigger BOTH orders (double-whipsaw), which can lead to massive losses. OCO ensures that you only commit to one direction at a time.

MT4 Limitation: Why you need an EA for OCO

MetaTrader 4 does not natively support OCO orders in its basic interface. If you place two pending orders manually, they are completely independent. To achieve OCO functionality, you must use a Background Expert Advisor or script that constantly monitors your account.

Once the EA detects that the OrderType() of a pending order has changed to an 'Active' market position (OP_BUY or OP_SELL), it immediately sends a delete command for the remaining pending order. This must happen in milliseconds to be effective during high-volatility events like NFP or interest rate announcements.

⚙️Parameter Logic

{ OCO Order Checklist }

01

Sequence: Place 2 pending orders / Link via Magic Number

02

Threshold: Minimum distance of 10 pips to avoid double-triggers

03

Constraint: Use an EA that monitors OnTick() for state changes

04

Market State: Only use during high-impact news (e.g., NFP)

05

Verified: Ensure the EA logs 'Pending Order Deleted' instantly

06

Risk: Use a hard Stop-Loss in both pending orders for safety

Coding OCO Logic: The OrderDelete Function

Implementing OCO in MQL4 involves a loop that iterates through all pending orders with a specific Magic Number. The logic is: if (activeTradesCount > 0) { DeleteAllPendingOrders(MagicNumber); }.

It is important to use a Safety Offset. During extreme news spikes, both pending orders might be hit by the same high-velocity price candle before the EA has time to process the first deletion. Setting the OCO orders far enough apart (e.g., 10-15 pips) is the best way to prevent 'Double-trigger' failures.

Strategy: Automating the News Straddle

The OCO mechanic is the engine of the Straddle Strategy. Five minutes before a major news event, the EA places OCO orders 20 pips above/below the market. If the news is positive, the Buy Stop hits, and the Sell Stop is deleted. If the news is a disappointment, the Sell Stop hits, and the Buy Stop is deleted. This 'Catch the Wave' approach is used by many HFT and low-latency algorithmic firms.

Frequently Asked Questions

Can I use OCO for day trading ranges?

Yes. Many breakout traders place OCO orders at the High and Low of the London session. When the price breaks out of the range, the corresponding order hits and the other side is removed. This automates the 'Breakout' setup, ensuring you don't stay exposed to a potential reversal on the other side of the box.

Is MT5 better for OCO orders?

MetaTrader 5 has native support for more advanced order types, but true 'Linked' OCO is still best handled via MQL script or Expert Advisor to ensure custom parameters (like slippage handling and time-to-live) are perfectly controlled by the trader's logic.

Recommended Reading