trading

If done order

An if-done order is a conditional, multi-step trade instruction where the execution of a primary parent order automatically activates one or more contingent child orders.

An if-done order (frequently designated in electronic brokerage architecture as an Order-Triggers-Order, or OTO, and often paired with a One-Cancels-the-Other, or OCO, bracket) is an automated conditional trading instruction. The structure consists of a primary “parent” order and one or more contingent “child” orders. The child orders remain completely dormant and unrouted to exchange matching engines until the parent order achieves complete execution. Once the parent fill is confirmed, the brokerage trading server instantly and automatically activates the child orders. In foreign exchange, equities, and futures trading, if-done orders represent an essential algorithmic risk-management tool, enabling traders to automate complete trade entries, profit-taking exits, and protective stop-losses without requiring continuous manual screen monitoring.

            IF-DONE BRACKET ORDER EXECUTION LIFECYCLE
            =========================================

     TRADER SUBMITS IF-DONE BRACKET (e.g., EUR/USD Buy Limit @ 1.0800)
                                   |
                                   v
     +-----------------------------------------------------------+
     |                 PARENT ORDER ACTIVE IN BOOK               |
     |         * Buy Limit: 1,000,000 EUR/USD @ 1.0800           |
     |         * Child Orders: DORMANT ON BROKER SERVER          |
     +-----------------------------------------------------------+
                                   |
                      Market Price Reaches 1.0800
                         PARENT ORDER FILLED
                                   |
                                   v
     +-----------------------------------------------------------+
     |             IF-DONE TRIGGER ACTIVATION EVENT              |
     |   Broker Server Instantly Releases Contingent OCO Bracket |
     +-----------------------------------------------------------+
                                   |
         +-------------------------+-------------------------+
         |                                                   |
         v                                                   v
+-------------------------------+                   +-------------------------------+
|  CHILD ORDER 1: TAKE-PROFIT   |                   |   CHILD ORDER 2: STOP-LOSS    |
| Limit Sell @ 1.0920 (+120 pips|                   | Stop Sell @ 1.0740 (-60 pips) |
+-------------------------------+                   +-------------------------------+
         \                                                   /
          +------------------------+------------------------+
                                   |
                  ONE-CANCELS-THE-OTHER (OCO) LOGIC
     If Take-Profit executes at 1.0920 -> Stop-Loss CANCELED INSTANTLY
     If Stop-Loss triggers at 1.0740  -> Take-Profit CANCELED INSTANTLY

Structural Mechanics of Parent-Child Orders

In standard trading operations, placing a protective stop-loss on an asset requires that the trader already own the underlying position. An investor cannot place an order to sell shares or currency units they do not possess without risking unauthorized naked short selling.

The if-done mechanism solves this structural constraint through a staged execution sequence:

  1. The Parent Stage: The trader submits an entry order, most commonly a limit order or stop order away from the current market price (e.g., buying a currency pair on a anticipated pullback to support).
  2. Server-Side Quarantining: The brokerage execution management system (EMS) routes the parent order to the liquidity provider or exchange central limit order book. However, the associated child exit orders are quarantined on the broker’s private server. They are not transmitted to the liquidity pool, meaning they do not consume additional margin or register on public market depth feeds.
  3. Execution Routing: The moment the parent order fills, the broker’s matching engine emits an execution confirmation message (via standard FIX protocol).
  4. Child Activation: The server instantly routes the child orders into the active market matching engine.

$$\text{If-Done State Machine}: \quad S_{\text{Child}} = \begin{cases} \text{Dormant}, & \text{if } S_{\text{Parent}} \in {\text{Pending}, \text{Cancelled}} \ \text{Active}, & \text{if } S_{\text{Parent}} = \text{Filled} \end{cases}$$

Common If-Done Variations in Professional Trading

Depending on market strategy and risk parameters, traders configure if-done instructions into three primary topologies:

1. If-Done Single Exit (Take-Profit or Stop-Loss Only)

The simplest variant links a single entry order to a single exit order. For example, a swing trader submits an entry order to buy crude oil futures at $75.00. The if-done instruction specifies that upon fill, an automatic profit-target limit order is activated to sell the position at $80.00.

2. If-Done OCO Bracket (The Professional Standard)

In modern institutional and retail forex trading, the most ubiquitous deployment is the If-Done OCO (One-Cancels-the-Other) Bracket:

  • The parent order executes an entry.
  • Once filled, two mutually exclusive child orders activate simultaneously: an upper Take-Profit limit order and a lower Stop-Loss market order.
  • The two child orders are mathematically linked: if the price rallies and fills the Take-Profit target, the broker’s server immediately cancels the resting Stop-Loss order, preventing the trader from being accidentally entered into an unintended opposing short position.

3. If-Done Trend-Following Pyramiding

Algorithmic trend-followers deploy if-done sequences to build positions in winning markets:

  • A parent breakout order buys 10 lots of an asset when it breaches multi-month resistance.
  • The child order is an if-done buy stop order for an additional 5 lots positioned higher up the trend, activating only after the initial breakout demonstrates momentum.
Order Configuration Parent Leg Child Leg(s) Primary Operational Objective
If-Done OCO Bracket Buy/Sell Limit or Stop 1 Take-Profit + 1 Stop-Loss Complete automated trade containment; fixed risk/reward
If-Done Trailing Stop Market or Limit Entry Dynamic Trailing Stop Locks in paper profits as trend extends
If-Done Scale-In Primary Breakout Entry Secondary Stop Entry Adds to winning positions automatically (pyramiding)
If-Done Reversal Target Exit Order Opposing New Entry Order Automatically flips position from long to short at key pivot

Critical Operational Risks and Slippage Dynamics

While if-done orders provide robust automation, traders must account for execution frictions inherent to electronic market microstructure:

1. Latency Gaps Between Fills

In fast-moving markets, such as during high-impact macroeconomic data releases (e.g., US Consumer Price Index or Federal Open Market Committee rate decisions), liquidity can vanish in milliseconds. While modern brokerage servers activate child orders within microseconds of parent execution, a violent market spike can gap past the child stop-loss price before the order is registered by liquidity providers, resulting in execution slippage.

2. Partial Fills and Child Order Resizing

A frequent complication occurs when a parent order is only partially filled:

  • If a trader submits a parent order to buy 1,000,000 units of currency, but available liquidity only fills 400,000 units, how do the child orders respond?
  • Institutional brokerages utilize dynamic resizing algorithms: the child take-profit and stop-loss orders are automatically resized to match the exact 400,000 units filled, ensuring the trader is not over-hedged.
  • Low-tier retail brokerages that lack automated child resizing may either fail to trigger the child orders entirely or trigger exit orders for the full original 1,000,000 units, creating unintended directional exposure if the remaining parent order is later cancelled.

3. Overnight Margin Requirements

Because child orders remain dormant until the parent order fills, brokers evaluate margin requirements based solely on the parent entry order. However, if a parent order fills overnight during an illiquid market session, the immediate activation of the position requires sufficient maintenance margin. If market volatility causes the position to move against the trader before child stops are reached, margin call algorithms can override contingent order logic.

Frequently Asked Questions

Can an if-done order be modified after the parent order has been submitted?

Yes. As long as the parent order has not yet been filled, a trader can adjust the parent price, cancel the entire structure, or edit the contingent child price levels. Once the parent order executes, the child orders become standard active working orders and can be modified or cancelled independently in the open order book.

What happens to the child orders if the parent order is cancelled?

If the parent order is cancelled manually by the trader, rejected by the exchange due to price collars, or expires at the end of the trading session (if placed as a Day order), all contingent child orders are automatically purged from the server without ever being submitted to the market.

Does an if-done order guarantee protection against market gaps?

No. An if-done order automates the submission of exit orders, but it cannot alter market mechanics. If an asset experiences a weekend gap or halts trading due to a corporate news announcement, opening significantly below the child stop-loss price, the stop order executes at the first available market price, which may be substantially worse than the specified stop level.

Ready to trade forex?

Open a free demo account with a regulated broker. Practice with virtual funds before risking real money.

Compare Brokers →