Brokex Docs
Docs/USER GUIDE/Stop Loss and Take Profit

Stop Loss and Take Profit

Protecting downside and locking in profits with on-chain close orders.

When creating a STOP_LOSS_LONG or TAKE_PROFIT_LONG order via BrokexRouter.createCloseOrder:

  • Your position shares are reserved (reservedCloseShares) and tagged with your current positionEpoch.
  • Keepers monitor BrokexRegistry.getRiskPrice18(asset) and execute the close when the trigger condition is met.
  • If you manually close your position first, positionEpoch increments and the stale close order can be cancelled by anyone.