Trailing stop & exits
Basics

Trailing stop & exits

Every collapsed Box carries a trailing stop, a liquidation level, a take-profit and, before collapse, an expiry.

Trailing stop

After collapse the engine tracks the best price since the fill: the highest mark for a long, the lowest for a short. The stop sits a fixed t below (long) or above (short) that best price, and only moves in your favour.

long:   stop = best · (1 − t)     best = max(mark since collapse)
short:  stop = best · (1 + t)     best = min(mark since collapse)

t runs from 0.5% to 25%. The default is half the band. A Turbo leg (above 25x) uses 0.03% to 1%.

Liquidation

A position is liquidated when its equity falls to 10% of margin M or less. Equity is margin plus refunded premium plus unrealised PnL at the oracle mark.

equity = M + refund + PnL(mark)
liquidate when equity ≤ 0.1 · M

Take-profit

Profit is capped at +10× M. When PnL reaches that level the position closes automatically. This bounds the largest single payout the vault can owe.

Expiry

Before collapse, the Box burns premium from its budget. If the budget runs out first, the Box expires: margin M is returned and the budget is spent. Top up at any time to avoid this.

Closing a Turbo leg: two steps

On a Turbo leg (above 25x) you can't close in one call: close() reverts with UseRequestClose. Instead:

  1. requestClose(id) records the time of the current oracle price.
  2. settleClose(id), called by a keeper or anyone, settles at the first later oracle update (at least one update after the request).

This stops anyone closing against a stale price. Stops, liquidations and take-profits on a Turbo leg still trigger through poke(). See 999x Turbo.

Exit reasons

CodeReasonWho triggers
0Closed by traderTrader (Turbo: requestClose, then settleClose by anyone)
1Trailing stopAny keeper via poke()
2LiquidationAny keeper via poke()
3Take-profit at +10× MAny keeper via poke()
4Expired (budget spent)Any keeper via poke()