# SL/TP

Stop Loss (SL) and Take Profit (TP) are conditional orders that automatically close or reduce a position when the index price reaches a specified level. They are the primary tools for managing downside risk and locking in gains.

## How It Works

An SL/TP order monitors the **index price** (the oracle price of the underlying asset). When the index price crosses your trigger level, the system executes the order on your behalf.

* **Stop Loss:** Closes the position when the price moves against you. For a long position, the SL triggers when the index price falls to or below your stop price. For a short, it triggers when the price rises to or above it.
* **Take Profit:** Closes the position when the price moves in your favor. For a long position, the TP triggers when the index price rises to or above your target. For a short, it triggers when the price falls to or below it.

When triggered, the order executes as a **market order** by default. Optionally, you can attach a **limit price** so that when triggered it places a limit order instead, giving you control over the execution price at the cost of the order potentially not filling.

{% hint style="info" %}
SL/TP orders trigger on the **index price**, not the mark price or last trade price. This reduces the risk of triggers caused by momentary orderbook dislocations.
{% endhint %}

## Privacy

SL/TP trigger prices are **encrypted on-chain**. Although the stop order objects exist on the Sui blockchain, their trigger levels cannot be read by scanning the ledger. Only the owner of the wallet that placed the order can retrieve them, by signing an authentication message that proves ownership.

This prevents **stop-hunting** — a practice where other market participants detect clustered stop levels and push the price to trigger them for profit. On Aftermath, your stop levels are invisible to everyone except you.

{% hint style="info" %}
Viewing your own stop orders requires a wallet signature. This is handled automatically in the Aftermath UI.
{% endhint %}

## Placing SL/TP Orders

There are three ways to use SL/TP:

* **On an existing position:** Attach an SL, a TP, or both directly to your current position in a market. The order size defaults to your full position size.
* **On a pending limit order (OTO):** When placing a limit order you can attach SL/TP at creation time. The SL/TP becomes active only once the limit order is matched and a position is opened. This is called a One-Triggers-Other (OTO) order.
* **Standalone stop order:** A general-purpose conditional order that triggers at a specified index price. Standalone stops support a reduce-only flag to ensure they only decrease exposure.

## Editing and Cancelling

You can edit trigger prices, size, and limit-order parameters on existing stop orders at any time. Cancelling a stop order removes it from the chain and refunds any gas allocated for its execution.

## Expiry

Stop orders support an optional expiry timestamp. If the order has not triggered by the specified time, it is automatically cancelled.
