Home › Blog › Algo Trading
Algo Trading

Bracket Orders, OCO and Stop-Loss Orders: Automating Your Exits

By Contraday··6 min read

How stop-loss, stop-limit, bracket and OCO orders work, how to choose between them, and why automatic exits remove emotion but come with execution risks.

Carr Lane Scaffolding, Jul23
Photo: Hullian111, CC BY-SA 4.0, via Wikimedia Commons.

Key takeaways

  • Placing exits at entry removes emotion.
  • Stop-limit orders control price but may not fill.
  • Gaps can skip your trigger.
  • Check order status and test the flow.

Why automate exits

The hardest decision in a trade is often the exit. Placing the stop and target as orders at entry removes the temptation to move or cancel them in the heat of the moment. Many traders find that automating exits is the simplest improvement to their discipline.

Stop-loss and stop-limit orders

A stop-loss market order triggers when a price is reached and then executes at the best available price, which can be worse than the trigger in fast markets. A stop-limit order triggers at the stop price but only executes within a limit price, which controls the price but risks not being filled at all if the market jumps past it. Choose based on whether you prefer certainty of exit or certainty of price.

Bracket orders

A bracket order combines an entry with a target and a stop-loss, so that when the entry fills, both exit orders are placed automatically. When one exit executes, the other is cancelled. Availability and rules depend on your broker and exchange, and products may differ, so check how your broker handles them.

OCO orders

OCO stands for one-cancels-the-other: two orders are linked so that when one executes, the other is cancelled. It is useful to place a profit target and a stop together on an existing position.

Execution risks

  • Gaps can skip your trigger, so the fill can be far worse; see overnight gap risk.
  • Illiquid options can fill poorly.
  • Orders can be rejected because of insufficient margin or price bands.
  • Not all order types are available for all products or after market hours.

Good habits

Place the stop as soon as you enter, check that it is active, and size the position from the stop distance (see stop-loss methods). Test the order flow in a simulator first. For algorithmic systems, always confirm order status programmatically, a point covered in API trading risks.

An example order set (illustrative)

You buy an index call spread at a net debit of 70. Immediately after the entry fills you place two exit orders as an OCO pair: a limit order to sell the spread at 110 (profit target) and a stop order to sell at 45 (the stop). When the first fills, the other is cancelled by the system. If your broker does not support OCO for options, you may need to place the target as a limit order and manage the stop manually or with an alert. The key point is to check how your broker handles each order type, including what happens when one leg of a multi-leg order fills and the other does not. Test it in small size before relying on it.

Common order-handling mistakes

  • Placing the stop but not checking that it is active, for example after a partial fill.
  • Forgetting to cancel a target when you exit manually, leaving an orphan order that could open an unwanted position.
  • Using market stops in thin options where the fill can be far away.
  • Not accounting for price bands or freeze quantities that can reject large orders.
  • Relying on after-hours orders that behave differently.

A good practice is to end each day by checking that no stray orders remain and that all positions have the protection you intended. If you automate, build the same checks in code and send an alert when anything is unusual; see API trading risks and kill switches.

Try it yourself — free tools

Frequently asked questions

What is the difference between a stop-loss and a stop-limit?

A stop-loss executes at the market once triggered; a stop-limit places a limit order, which controls the price but may not fill.

What is a bracket order?

An entry order combined with automatic target and stop-loss orders, so that exits are placed as soon as the entry executes.

Does a stop-loss guarantee my exit price?

No. In fast or gapping markets the fill can be worse than the trigger price.

Educational content, not investment advice. Trading in options involves substantial risk of loss. Backtested or hypothetical results are not live results and past performance does not guarantee future returns.

Related reading