# Close & Cancel

***

### Overview

Knowing how to exit is just as important as knowing how to enter. Whether you're taking profits, cutting losses, or cleaning up stale orders, Close & Cancel gives you full control over unwinding your trades on Hyperliquid.

**What you can do:**

* Close individual positions or all positions at once
* Cancel specific orders or all pending orders
* Partially close positions to take profits while staying in the trade
* Clean up orphaned orders after closing positions

***

### Closing Positions

Closing a position exits your trade at market price. Your unrealized PnL becomes realized PnL and the margin is freed back to your account.

#### Close a Specific Position

| Prompt                        | Interpretation                           |
| ----------------------------- | ---------------------------------------- |
| "Close my BTC position"       | Closes BTC long or short at market price |
| "Exit my ETH short"           | Closes ETH short position                |
| "Close SOL"                   | Closes SOL position                      |
| "Get out of my DOGE position" | Closes DOGE at market                    |
| "Flatten BTC"                 | Closes BTC position entirely             |

#### Close All Positions

| Prompt                | Interpretation                             |
| --------------------- | ------------------------------------------ |
| "Close all positions" | Closes every open position at market price |
| "Flatten everything"  | Same, exits all positions                  |
| "Close all my perps"  | Closes all perpetual positions             |
| "Exit all trades"     | Closes everything at market                |

{% hint style="warning" %}
Closing all positions executes market orders for each position. In volatile markets, slippage may vary per asset.
{% endhint %}

#### Partial Closes

You don't have to close an entire position. You can take partial profits or reduce size while keeping the rest open.

| Prompt                             | Interpretation                   |
| ---------------------------------- | -------------------------------- |
| "Close half my BTC position"       | Closes 50% of BTC at market      |
| "Close $500 of my ETH long"        | Reduces ETH position by $500     |
| "Take profit on 25% of my SOL"     | Closes a quarter of SOL position |
| "Reduce my BTC position by $2,000" | Reduces notional by $2,000       |
| "Scale out of ETH, close a third"  | Closes \~33% of ETH position     |

Partial closes are useful for:

* **Taking profits while staying in** - Lock in gains on part of the position
* **Reducing risk** - Lower your exposure without fully exiting
* **Scaling out** - Gradually exit a winning trade at different levels

***

### Cancelling Orders

Cancel pending orders that haven't executed yet. This includes limit orders, stop-losses, take-profits, and conditional orders.

#### Cancel Orders for a Specific Asset

| Prompt                                      | Interpretation                    |
| ------------------------------------------- | --------------------------------- |
| "Cancel my ETH orders"                      | Cancels all pending orders on ETH |
| "Cancel my BTC limit order"                 | Cancels the BTC limit order       |
| "Remove my SOL stop-loss"                   | Cancels the SOL stop-loss order   |
| "Cancel the take-profit on my ETH position" | Removes the ETH TP order          |
| "Delete my pending DOGE orders"             | Cancels all DOGE orders           |

#### Cancel All Orders

| Prompt                      | Interpretation                                |
| --------------------------- | --------------------------------------------- |
| "Cancel all orders"         | Cancels every pending order across all assets |
| "Cancel all my open orders" | Same, clears all pending orders               |
| "Remove all pending orders" | Cancels everything                            |

***

### Close + Cancel Together

When you close a position, any attached TP/SL orders don't automatically cancel. You'll want to clean those up to avoid them triggering and accidentally opening a new position.

| Prompt                                            | Interpretation                                             |
| ------------------------------------------------- | ---------------------------------------------------------- |
| "Close my BTC position and cancel all BTC orders" | Exits position and cleans up orders                        |
| "Flatten ETH and remove all ETH orders"           | Closes position and cancels pending orders                 |
| "Close everything and cancel all orders"          | Nuclear option, exits all positions and cancels all orders |

#### Why This Matters

```
Scenario:
1. You're long BTC with a stop-loss at $92,000
2. You manually close the position at $97,000
3. The stop-loss order is still active
4. BTC drops to $92,000
5. The stop-loss triggers and opens a NEW short position

→ Always cancel attached orders when closing positions manually
```

***

### Emergency Exit

If the market is moving fast and you need to get out of everything immediately:

| Prompt                                      | Interpretation                               |
| ------------------------------------------- | -------------------------------------------- |
| "Close all positions and cancel all orders" | Exits everything, cancels everything         |
| "Emergency exit, flatten everything"        | Closes all positions at market               |
| "Get me out of everything right now"        | Full liquidation of all positions and orders |

This sends market orders to close every open position and cancels all pending orders. It's the fastest way to go fully flat.

***

### What Happens When You Close

When a position is closed:

1. **Market order sent** - Your position is closed at the best available price
2. **Fill generated** - A "Close Long" or "Close Short" fill appears in your trade history
3. **PnL realized** - Unrealized PnL becomes realized, added to your account balance
4. **Margin freed** - The collateral backing the position returns to your free margin

#### PnL Calculation

```
Long:  Realized PnL = (Close Price - Entry Price) × Size - Fees
Short: Realized PnL = (Entry Price - Close Price) × Size - Fees
```

***

### Common Workflows

#### Taking Partial Profits

```
1. "How's my BTC position?"         → Check current PnL
2. "Close half my BTC position"     → Lock in profits on half
3. "Move my stop to breakeven"      → Risk-free on the remaining half
4. "Move TP to $110,000"            → Let it ride with updated target
```

#### Cutting Losses

```
1. "Show my positions"              → Identify losing position
2. "Close my SOL position"          → Cut the loss
3. "Cancel all SOL orders"          → Clean up attached orders
```

#### End of Day Cleanup

```
1. "Show my positions"              → Review what's open
2. "Close all positions"            → Go flat for the night
3. "Cancel all orders"              → Clear any pending orders
4. "Show my portfolio"              → Review the day's P&L
```

***

### Pro Tips

1. **Always cancel orders after manual closes** - Orphaned TP/SL orders can open unintended positions
2. **Use partial closes to manage winners** - Don't be binary, scale out gradually
3. **Check the order book before closing large positions** - Thin liquidity means more slippage
4. **Close and cancel together** - Make it a habit to say "close position and cancel orders" in one command
5. **Keep a closing checklist** - Position closed? Orders cancelled? PnL recorded? Margin freed?
6. **Don't panic close in volatile markets** - If you have a stop-loss set, let it do its job

***
