# Attach TP/SL

Add a take-profit, stop-loss, or trailing stop to a Limit or Market order, from the Order Form or on an order that is already open.

Attach an exit to a Limit or Market order so it is set up together with your entry. The exit, called a leg, protects whatever the order fills, without you watching the market.

## Attach legs in the Order Form

1. Set the entry

   On the **Limit** or **Market** tab, enter the price and amount first. The legs are measured from this entry.

2. Select TP/SL

   Select **TP/SL**, then choose **Simple** or **Advanced** in the menu beside it.

3. Set the levels

   In **Simple**, fill in **Take profit at** and **Stop loss at**. You can enter each one as a **% change**, a **P\&L** amount, or a **Price**.

   In **Advanced**, select **Add take profit / stop loss** to open the **TP / SL** dialog. There you can choose **Market** or **Limit** execution for each leg, use a trailing stop in place of the stop-loss, choose the Price Source, and turn on **OCO (One-Cancels-Other)**.

4. Review and submit

   Check the estimated P\&L, then submit the order. If [Order confirmation](https://testnet.polyester.com/docs/user-docs/trade/order-confirmations) is on, the review lists the legs.

After a Buy order, a take-profit must sit above the entry price and a stop-loss below it. After a Sell order, the sides swap. A trailing stop that buys back after a Sell order also needs a **Buy-back Limit**, the most it pays per unit.

## Add or change legs on an open order

The **Attached Risk** column in [Open Orders](https://testnet.polyester.com/docs/user-docs/trade/widgets/open-orders) shows the **TP**, **SL**, **TS**, and **OCO** an order carries. Select **TP/SL/TS** on an order with no legs to open **Modify Order** on the take-profit section. To change or remove existing legs, open **Modify Order** from the row.

On the Polyester Chart, you can also [drag a leg to a new price](https://testnet.polyester.com/docs/user-docs/trade/chart-trading).

## How attached legs behave

- **They follow the fills.** Legs arm as the parent order fills and protect the quantity it has filled so far, including later fills.
- **They share one position.** Only one exit works at a time, and it covers the remaining position.
- **OCO decides what a cancel ends.** With OCO on, canceling one leg's exit order ends both legs. With OCO off, the other leg keeps protecting what remains.
- **They end with the position.** Legs are canceled if the parent order ends without a fill, and end once no position remains for them to exit.
- **They hold balance.** Legs that sell reserve the Base Asset as each parent fill settles. A buy-back reserves the Quote Asset from the moment the order is created, for the part of its cost the sale may not return. Orders and withdrawals that would use this reserve are rejected until you reduce or cancel the legs.

The order an exit creates is subject to the Pair's minimums and market state. [Order Triggers](https://testnet.polyester.com/docs/user-docs/trade/widgets/order-triggers) explains what happens when an exit is rejected or when it fires while the parent is still open.

## Example

Let's say Bitcoin is trading at **100,000 USDT**. You place a Limit buy for **0.01 BTC** at 100,000 USDT, with a take-profit at **110,000 USDT** and a stop-loss at **95,000 USDT**, both on Market execution, with OCO on.

1. The order fills 0.01 BTC at 100,000 USDT, so both legs arm for 0.01 BTC.
2. BTC rises to 110,000 USDT, and the take-profit submits a Market sell for 0.01 BTC.
3. The exit sells the whole position, so the take-profit shows as completed and the stop-loss as canceled.

*These are example prices. A Market exit can fill at several prices within its slippage cap.*
