# Conditional

Wait for the price to reach a level you choose, then buy or sell at market or with a limit price. Use it to take profit or to stop a loss.

A conditional order is an order that waits. You choose a price, the **Trigger Price**, and nothing happens until the market reaches it. Then Polyester places your order: a market order that trades right away, or a limit order at a price you set.

It's most often used to close a position for you: to lock in a gain once the price rises to your target (a **take profit**), or to limit a loss if the price falls to a level you choose (a **stop loss**). Where you put the trigger decides which one you get; see [Take profit or stop loss](#take-profit-or-stop-loss).

The chart below plays one out. Drag the **Trigger Price**, switch between **Buy** and **Sell** or **Market** and **Limit**, and change **Max Slippage** to see how each choice changes the result.

Holding 0.5 BTC

−$5.92

BuySell

MarketLimit

Max Slippage 0.5%

## How it works

1. You set the order

   Choose **Buy** or **Sell**, a **Trigger Price**, how it executes (**Market** or **Limit**), and the amount.

2. Polyester holds your balance

   The amount the order can use is reserved right away, so it's there when the trigger fires. It stays reserved until the order fires or you cancel it.

3. The trigger waits

   The order watches the market's last price, or its index price if you choose. You can see it on the **Conditional** tab of [Open Orders](https://testnet.polyester.com/docs/user-docs/trade/widgets/open-orders) and as a line on the [chart](https://testnet.polyester.com/docs/user-docs/trade/chart-trading).

4. The price reaches your trigger

   The trigger fires the moment the price it watches reaches your **Trigger Price**.

5. Your order is placed

   With **Market**, Polyester sends a market order that fills against the order book immediately. With **Limit**, it places a limit order at your **Execution Price**, which fills at that price or better.

A conditional order has no expiry. It waits until the price reaches the trigger or you cancel it.

## Take profit or stop loss

You don't choose "take profit" or "stop loss". You choose a side and a trigger, and where the trigger sits compared to the current price decides what the order does:

| You choose             | Trigger above the current price                                      | Trigger below the current price                                   |
| ---------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------- |
| **Sell** (you hold it) | **Take profit.** Sell once the price has risen to your target.       | **Stop loss.** Sell once the price has fallen, to limit the loss. |
| **Buy** (you sold it)  | **Stop loss.** Buy back before the price climbs further against you. | **Take profit.** Buy back cheaper than you sold.                  |

A few rules follow from this:

- **The trigger can't equal the current price.** The form can't tell which way you mean, and says *Set a trigger above or below the current price.*
- **The direction is fixed when you submit.** The form compares your trigger with the price at that moment. If you later edit the trigger, it has to stay on the same side: the form says *Keep the trigger above the current price.* or *Keep the trigger below the current price.*
- **Check the trigger against the live price before you submit.** If the price crosses your trigger while you're filling in the form, the order flips: a sell meant as a stop loss becomes a take profit that waits for the price to rise back.

## Market or limit?

When the trigger fires, the order executes one of two ways. This is the most important choice you make.

|                | **Market**                                                         | **Limit**                                                 |
| -------------- | ------------------------------------------------------------------ | --------------------------------------------------------- |
| What it places | A market order for your amount                                     | A limit order at your **Execution Price**                 |
| Fills          | Right away, against the best prices on the book                    | Only at your execution price or better                    |
| Price you get  | Close to where the price is when it fires, within **Max Slippage** | Never worse than your execution price                     |
| The risk       | A fast move can fill well past your trigger                        | The price can move past your limit and leave you unfilled |
| Choose it when | Getting out (or in) matters more than the exact price              | The price matters more than making sure the trade happens |

Most stop losses use **Market**, because a stop is about getting out. Take profits often use **Limit**, because you have a target price in mind and can afford to wait for it.

### Market execution

When the trigger fires, Polyester sends a market order. It fills against the best prices on the order book at that moment, the way an ordinary [market order](https://testnet.polyester.com/docs/user-docs/trade/order-types/market-order) does.

**The fire price.** The trigger fires on the first trade at or past your trigger price. In a calm market that trade is right at your trigger. In a fast move it can be well past it: if the price drops from 66,100 straight to 65,900, a trigger at 66,000 fires at 65,900. That first trade is the **fire price**, and your order fills from there, not from your trigger.

**Max Slippage** is your protection. It's the furthest from the fire price your order is allowed to fill:

- A **sell** never fills below the fire price minus Max Slippage.
- A **buy** never fills above the fire price plus Max Slippage.
- Whatever can't fill within that range is canceled. You keep the part that didn't sell, or the funds that weren't spent.

So Max Slippage is a trade-off. A tight limit protects your price but can leave part of the order unfilled in a fast market. A wide limit makes sure the whole order fills but accepts a worse price.

The chart below is a stop loss at 66,000 that the price falls straight through. Change **Max Slippage** to see how much of the 0.5 BTC sells: at 0.5% only part of it fills and the rest is canceled, while at 2% all of it fills, at a lower price.

Holding 0.5 BTC

−$5.92

Max Slippage 0.5%

A sell stop at 66,000 caught in a gap. Lower Max Slippage protects the price but fills less; higher fills more, further down.

> **A trigger price is not a guaranteed fill price**
>
> The trigger decides when the order is sent. The price you get depends on the order book at that moment, within your Max Slippage. Max Slippage can't protect you from the gap between your trigger and the fire price, because it's measured from the fire price.

**Setting Max Slippage.** With **Market** selected, **Max Slippage** appears in the order details above the submit button. Select it to change it:

- Enter a **percentage** of the price (from 0.01% to 99.99%), or switch to an amount in the Quote Asset, such as 500 USDT.
- It starts at the Pair's default, and once you set it, the Order Form remembers your choice for that Pair.
- Your [order confirmation](https://testnet.polyester.com/docs/user-docs/trade/order-confirmations), if it's on, shows it before you submit.

Market execution isn't available on a Pair that only accepts post-only orders, because a market order always takes liquidity. The form keeps **Limit** selected there.

### Limit execution

When the trigger fires, Polyester places a limit order at your **Execution Price**. From then on it behaves like any [limit order](https://testnet.polyester.com/docs/user-docs/trade/order-types/limit-order): it fills at your price or better, can fill in parts, and waits on the book for the rest.

When you switch to **Limit**, the execution price starts at your trigger price. Where you move it from there matters:

- **Sell, execution price at or below the trigger:** when the trigger fires, the order can sell right away to bids at or above your price. Your execution price is a floor: you'll never sell below it. This is the usual setup for a stop loss limit.
- **Sell, execution price above the trigger:** the order waits on the book for the price to keep rising. If the price turns back first, nothing sells. This suits a take profit when you'd rather wait for a better price.
- **Buy** is the mirror image: an execution price at or above the trigger can buy right away, and one below it waits for the price to fall further.

The shaded band on the chart is where your limit order can fill. Here the trigger fires, but the price turns back before it reaches the execution price, so the order never fills.

Holding 0.5 BTC

−$5.92

The trigger fires and places a limit order, but the price turns back before reaching the execution price.

> **A limit can leave you unfilled**
>
> If the price moves past your execution price before the order fills, for example in a gap down through a stop loss limit, the order stays open on the book and you keep the position you meant to exit.

**Time In Force**, under **Advanced**, decides what happens to any part that can't fill right away once the order is placed:

- **Good Til Canceled**, the default, keeps it on the book until it fills or you cancel it.
- **Immediate Or Cancel** fills what it can at once and cancels the rest.
- **Fill Or Kill** fills the whole amount at once, or cancels the order.

Good Til Date isn't offered for conditional orders. See [Time-in-Force & Post-Only](https://testnet.polyester.com/docs/user-docs/trade/order-types/time-in-force-and-post-only) for more.

## Which price the trigger watches

The **Trigger Price** field has a **Last** / **Index** toggle that sets the price your trigger compares against:

- **Last**, the default, is the most recent trade on the Pair. It reacts fastest, but a single large trade can move it for a moment and fire your trigger on a brief spike.
- **Index** is the market's index price. It moves more smoothly, so a brief spike in the last price may not fire your trigger. If the index price goes stale, the trigger waits until it updates.

Holding 0.5 BTC

+$1.48

Last priceIndex price

Last price Index price

Whichever price fires the trigger, a market order still fills against this Pair's order book. See [which price a trigger watches](https://testnet.polyester.com/docs/user-docs/trade/widgets/order-triggers#which-price-a-trigger-watches) for the details.

## Set it up

1. Open the Conditional form

   In the [Order Form](https://testnet.polyester.com/docs/user-docs/trade/widgets/order-form), choose **Buy** or **Sell**, open **More**, and select **Conditional**.

2. Enter the trigger price

   Type the **Trigger Price**. Leave the toggle in the field on **Last**, or switch it to **Index**.

3. Choose the execution

   Use the **Market** / **Limit** toggle in the **Execution Price** field. For **Limit**, type the execution price; it starts at your trigger price. For **Market**, the field just shows Market.

4. Enter the amount

   Enter how much to buy or sell, or use the slider. A market order is sized at your trigger price, a limit order at your execution price.

5. Check the details

   For **Market**, check **Max Slippage** above the submit button. Under **Advanced** you can set **Time In Force** (Limit), **Self-Trade Prevention**, and, on a buy, which Asset pays the fee.

6. Submit

   If [Order confirmation](https://testnet.polyester.com/docs/user-docs/trade/order-confirmations) is on, review the trigger price, execution, and Max Slippage or execution price before you confirm.

Two shortcuts fill in the form for you:

- **From the chart.** On the [Polyester Chart](https://testnet.polyester.com/docs/user-docs/trade/chart-trading#start-an-order-from-a-price), select the **+** at a price, then **Sell stop** (below the last price) or **Buy stop** (above it). You can drag the preview line before you submit.
- **From the Order Book.** Selecting a price in the [Order Book](https://testnet.polyester.com/docs/user-docs/trade/widgets/order-book) fills in the trigger price for Market, or the execution price for Limit.

To add a take profit or stop loss to the order that opens a position, [attach a TP/SL](https://testnet.polyester.com/docs/user-docs/trade/attach-tp-sl) instead. To protect the same amount with both a take profit and a stop loss, use an [OCO](https://testnet.polyester.com/docs/user-docs/trade/order-types/oco).

## What your balance holds

The balance is reserved when you create the order, not when it fires:

- **Sell:** the Base Asset amount you're selling.
- **Buy with Market:** enough Quote Asset to cover the amount at your trigger price raised by your Max Slippage, plus the fee. This is why the maximum buy amount shrinks when you raise Max Slippage.
- **Buy with Limit:** the amount at your execution price, plus the fee.

Reserved balance can't be used by another order. That's why two conditional orders can't both sell the same coins: the second is refused for lack of balance. Use an [OCO](https://testnet.polyester.com/docs/user-docs/trade/order-types/oco) for a take profit and stop loss on the same amount.

## Track, edit, and cancel

- **Before it fires,** the order is on the **Conditional** tab of [Open Orders](https://testnet.polyester.com/docs/user-docs/trade/widgets/open-orders). Its **Type** reads **Conditional Market** or **Conditional Limit**.
- **You can edit the Trigger Price** while it waits, from the table or by dragging its line on the chart. It has to stay on the same side of the current price. To change anything else, cancel it and create a new one.
- **After it fires,** a market order's fills appear in [Order History](https://testnet.polyester.com/docs/user-docs/trade/widgets/order-history). A limit order shows on the **Limit** tab of Open Orders while it waits on the book.
- **Canceling the conditional order** before it fires releases the reserved balance. Once it has fired, canceling it doesn't cancel the limit order it placed; cancel that order separately.

## When it doesn't fill as expected

- **The price never reaches the trigger.** The order keeps waiting, and your balance stays reserved.
- **Market, partially filled or not at all.** The book didn't hold enough within Max Slippage of the fire price. The rest was canceled and its balance returned.
- **Limit, not filled.** The price moved past your execution price before the order could fill. It stays on the book until the price comes back, or until you cancel it.
- **Rejected when it fires.** Your balance, an account policy, or the market's state can reject the order the trigger places.

## Examples

### A stop loss in a fast drop

Bitcoin trades at **100,000 USDT** and you hold **0.5 BTC**. You place a sell Conditional order with a trigger price of **95,000 USDT** and **Market** execution. The trigger is below the price, so it's a stop loss.

The price falls quickly, and the first trade past your trigger is at **94,000 USDT**. That's the fire price.

- **With Max Slippage 0.5%,** the lowest price your order accepts is 93,530 USDT. Only 0.2 BTC of bids sit between 94,000 and 93,530, so 0.2 BTC sells for about 18,760 USDT and the other 0.3 BTC is canceled. You still hold 0.3 BTC.
- **With Max Slippage 2%,** the lowest price is 92,120 USDT. All 0.5 BTC sells, averaging 93,300 USDT, for 46,650 USDT.

Neither result is 95,000 USDT. The trigger decides when the order fires, not the price you get.

### A take profit at a target

You hold **0.5 BTC** bought at 100,000 USDT. You place a sell Conditional order with a trigger price of **110,000 USDT**, **Limit** execution, and an execution price of **109,800 USDT**.

1. A trade at 110,000 USDT fires the trigger.
2. Polyester places a limit sell for 0.5 BTC at 109,800 USDT.
3. Bids at 109,900 USDT buy all 0.5 BTC.

**Result:** you sell 0.5 BTC for 54,950 USDT before fees. If the price had dropped below 109,800 USDT before the order filled, it would have waited on the book instead.

*These are example prices. Real fills depend on the order book when the trigger fires.*

## FAQ

### Is this a stop loss or a take profit?

Both. The same order becomes a stop loss or a take profit depending on your side and where you put the trigger compared to the current price. See [Take profit or stop loss](#take-profit-or-stop-loss).

### Why did my stop loss sell below my trigger price?

With **Market**, the order fills from the fire price, the first trade at or past your trigger. In a fast move that trade can be well past your trigger, and the order fills from there, within your Max Slippage.

### Why did only part of my order fill?

With **Market**, the order book didn't hold enough within Max Slippage of the fire price, so the rest was canceled. With **Limit**, the price moved past your execution price after part of the order filled; the rest waits on the book.

### Can I set both a take profit and a stop loss on the same coins?

Not with two conditional orders: each reserves its own balance, so the second is refused. Use an [OCO](https://testnet.polyester.com/docs/user-docs/trade/order-types/oco), which places both and cancels one when the other trades.

### How is this different from a trailing stop?

A conditional order's trigger stays where you put it. A [trailing stop](https://testnet.polyester.com/docs/user-docs/trade/order-types/trailing-stop) moves its trigger along as the price moves in your favor.
