What Is an OCO Order in Gold Trading, and Why MetaTrader Has None

What is an oco order, Gold Empire article cover on one cancels the other orders in gold trading

Sooner or later every gold trader asks the same question in the same tone of mild frustration: what is an oco order, and why can I not find one in my platform? You read about OCO orders on a stock forum, or someone in a chat told you to “just set an OCO around the range,” and then you open MetaTrader, look through the order ticket, and there is no such button. You start to wonder whether your broker gave you a cut down version of the platform.

Your broker did not. The button is not there because the order type is not there, and understanding why is worth more to your account than the button would have been.

What an OCO order actually is

OCO stands for one cancels the other. It is a pair of orders joined by a rule: if either one executes, the platform automatically cancels the other. The whole point is exclusivity. You are telling the venue that exactly one of two things may happen, never both, and never neither by accident.

People reach for it in two very different situations, and it matters which one you are in.

The first is a bracket around a position you already hold. You are long, and you want out at a loss below or a gain above, whichever arrives first. The moment one side fills, the other must vanish, because otherwise it would open a fresh position in the opposite direction.

The second is a breakout straddle on a position you do not hold yet. Gold is coiled in a range before a data release, you do not care which way it breaks, so you put a buy stop above and a sell stop below and let the market choose. Whichever triggers, the other should be cancelled. If the difference between those two order types is not yet second nature, buy stop and buy limit explained is the groundwork for this article.

Those two uses look similar on a chart. In terms of what can go wrong, they are nothing alike, and most of the trouble I have watched people walk into comes from treating the second like the first.

What is an OCO order in gold trading, and what MetaTrader gives you instead

Here is the part nobody says plainly. MetaTrader 5 has no OCO order type. Not hidden, not premium, not broker dependent. It simply does not exist in the platform’s order model.

You can check this against the platform’s own documentation rather than taking my word for it. The MQL5 reference for order properties lists every value the platform recognises in its ENUM_ORDER_TYPE enumeration. There are nine of them: two market orders, buy and sell; six pending orders, being buy limit, sell limit, buy stop, sell stop, buy stop limit and sell stop limit; and one housekeeping type for closing a position with an opposite one. That is the complete list. There is no OCO entry, and the words “one cancels the other” do not appear on the page at all.

So when someone tells you to set an OCO in MetaTrader, they are describing something the platform cannot do as a single instruction. What you can do is one of two things, and the difference between them is the whole article.

The stop and the target you already have are an OCO pair

If your OCO is a bracket around an open position, you already have it, and you have had it all along.

Attach a stop loss and a take profit to a position in MetaTrader and you have built a one cancels the other pair without knowing it. The two levels are properties of the position, not independent orders sitting in the market. When one of them triggers, the position closes. Once the position is closed there is nothing left for the other level to act on, so it stops existing as a matter of arithmetic rather than as a matter of the platform remembering to cancel something.

This is the quietly important bit. A native OCO relies on the venue’s cancel logic firing correctly in a fast market. A stop and target attached to a position rely on the position simply no longer being there. The second is structurally safer, because there is no cancellation that can arrive late. Where those two levels belong is a separate and harder question, which I have worked through in where to place a stop loss on XAUUSD.

If you have ever wondered why the platform’s own trading concepts documentation treats stop loss and take profit as attributes of a position rather than as orders in a list, that is why. They are not two orders that happen to be related. They are two exit conditions on one thing.

So for the bracket use case, the honest answer to what is an oco order in MetaTrader is: it is your stop and your target, and it is already working. Nothing to install, nothing to ask your broker for.

The breakout straddle is where it goes wrong

The second use case is the one that costs money, and it costs money precisely because there is no native OCO to protect you.

You want to catch a break out of a range in either direction, so you place a buy stop above and a sell stop below. Two independent pending orders. Neither one knows the other exists. There is no rule joining them, because the platform has no way to express that rule.

Now ask what happens in the exact market condition you placed them for. A data release lands, gold spikes up through your buy stop, reverses hard within the same minute, and runs down through your sell stop. Both orders fill. You are now long and short at the same time.

People’s first reaction is relief: net exposure zero, so no harm done. That reaction is wrong, and it is wrong in a way that shows up on the statement rather than on the chart.

Chart for what is an oco order showing the cost of a double fill when both simulated OCO legs trigger in gold trading
What is an OCO order worth in MetaTrader: the cost of a double fill when both legs of a simulated bracket trigger.

The arithmetic, with every assumption named

Let me put real figures on it. I am going to state every assumption, because a number without its assumptions is decoration.

Assume a standard retail gold contract where 1.00 lot is 100 troy ounces. Assume you placed each leg at 0.10 lot, so 10 ounces per side. Assume the spread at the moment of fill is 0.30 US dollars per ounce, which is wide but realistic in the seconds after a release. Assume commission of 3.50 US dollars per lot per side. Notice that no gold price appears anywhere in this calculation. Every figure below is a difference, not a level, which is exactly why the arithmetic holds whatever gold happens to be doing.

Spread cost on one side is 10 ounces at 0.30, so 3.00 dollars. Commission on one side is 3.50 dollars per lot times 0.10 lot, so 0.35 dollars. Opening one position therefore costs 3.35 dollars.

If both legs fill, you paid that twice: 6.70 dollars to open. And because you now hold two positions instead of one, you have to close two, so you pay the exit side twice as well. The intended trade, opened and closed, costs 6.70 dollars in total. The double fill, opened and closed, costs 13.40 dollars.

That is a 100 percent cost penalty for a net position of zero. You paid double to achieve nothing. And that is before the two positions sit overnight and collect two separate financing charges, one on each side, which is a subject I have written about separately in what swap is in gold trading.

Scale it and the point sharpens. At 1.00 lot per leg rather than 0.10, opening one position costs 33.50 dollars, and the same arithmetic gives 67.00 dollars for the intended round trip against 134.00 dollars for the double fill. The percentage does not change. The dollars do.

Fill policy decides what happens to the rest of your order

There is a second mechanism here that most people never look at, and it is on the same documentation page as the order types.

Every order carries a fill policy, and MetaTrader defines three. Fill or kill means, in the documentation’s own words, that “an order can be executed in the specified volume only. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed.” Immediate or cancel means “a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. If the request cannot be filled completely, an order with the available volume will be executed, and the remaining volume will be canceled.” Return means “in case of partial filling, an order with remaining volume is not canceled but processed further.”

Read that third one again with the straddle in mind. Under a return policy, a partially filled leg leaves a live remainder in the market. So the failure mode is not only “both legs filled.” It can be “one leg filled, the other partially filled, and a fragment of the second is still sitting there waiting.” You now hold a position whose size you did not choose and a working order you have forgotten about.

None of this is exotic. It is the ordinary behaviour of a platform that has no OCO order type, being asked to do an OCO order’s job by a trader who assumed the platform would join the two orders up.

Free gold survival sheet

Get the free Gold Empire survival sheet, a one-page guide to protecting your account through the kind of market this article describes. One email, no spam, unsubscribe anytime.

Get the free survival sheet →

What to do instead, in plain terms

For a bracket on an open position, use the stop and target attached to the position. That is your OCO, it is structurally safer than a native one, and it needs nothing added.

For a two sided breakout, accept that you are running two unlinked orders and manage the consequence rather than pretending it away. That means being present when the orders can trigger, because the only thing that cancels the losing leg is you. It means sizing each leg on the assumption that both could fill, not one. And it means knowing your fill policy, so a partial fill does not leave a fragment behind.

If a genuine linked OCO matters to how you trade, then it is a platform question rather than a technique question, and it belongs in the same conversation as spreads, execution and financing when you are choosing a broker for gold trading. Some venues outside the MetaTrader family do offer native OCO. That is a legitimate reason to prefer one, as long as you are honest that you are choosing it for the order type and not because a new platform will fix a process problem.

The wider habit is the one I keep coming back to. Every order you place is a promise about what will happen without you. When you know exactly what the platform has promised, you can plan. When you assume it promised something it never did, the market finds the gap for you, usually on a release day, usually at the worst size you have traded all month. Sizing that survives that discovery is the subject of risk management in gold trading, and it is the piece I would read next.

Frequently asked questions

What is an OCO order in the simplest possible terms?

Two orders joined by a rule that says if one executes, cancel the other. The purpose is to guarantee that exactly one of two outcomes happens.

Does MetaTrader 4 have OCO orders?

No. MetaTrader 4 has a smaller order set than MetaTrader 5, not a larger one, so if MT5 has no OCO type then MT4 certainly does not. The same workaround and the same double fill risk apply.

Is a stop loss and take profit really an OCO?

Functionally yes, and arguably better. Both are exit conditions on one position, so when either fires the position is gone and the other has nothing left to close. There is no cancellation instruction that could arrive too late.

Can an expert advisor create a real OCO in MetaTrader?

It can imitate one. A script can watch for one leg filling and then delete the other. That is a monitoring loop, not an exchange level rule, so it depends on your terminal running, your connection holding and the loop reacting faster than the market. It narrows the gap without closing it.

Where did the figures in this article come from?

The order type list and the three fill policy descriptions are quoted from the MQL5 order properties documentation, linked above. The cost figures are my own arithmetic from the assumptions stated in the article, being 100 ounces per lot, 0.10 lot per leg, 0.30 dollars per ounce of spread and 3.50 dollars per lot per side of commission. No gold price is used in any of them.

If both legs fill, should I close both immediately?

That is a decision about your own plan and your own risk, and it is not something a stranger should hand you as an instruction. What I will say is that holding a long and a short in the same instrument means paying two sets of costs for zero net exposure, and that is a position worth understanding rather than leaving to drift.

Where Gold Empire fits

Gold Empire is a free place to learn how gold actually behaves and how accounts actually die, written for people who would rather survive the first two years than have a spectacular first month. Everything on the site is free to read. If you are new here, start here is the guided way in, and it explains who writes this and why. There is a free survival sheet if you want the one page version, and an optional kit for people who want the whole framework in order. Nothing here promises you a return, because nobody honest can.

About the author

Matthew has spent a long time around gold, most of it learning things the slow way, and now writes them down so other people can learn them the fast way. He is more interested in the mechanics that quietly drain accounts than in the setups that fill timelines. Nothing in this article is personal advice, and no entry, stop or target discussed should be treated as a signal.


This article is educational content about how orders and platforms work. It is not investment advice, not a recommendation, and not a solicitation to trade. Trading gold carries a real risk of losing money, including more than you deposit in some account types. Nothing here accounts for your personal circumstances, and no entry, stop or target discussed should be treated as a signal. If you are unsure, speak to someone properly qualified in your own jurisdiction before you risk anything.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *