For the complete documentation index, see llms.txt. This page is also available as Markdown.

Take profit and stop loss (TP/SL)

AFX provides flexible Take Profit (TP) and Stop Loss (SL) options that can be set when placing an order or added to an existing position.

Setting TP/SL on Orders

When placing a Market or Limit order, you can attach TP and SL triggers. The default mode is Entire Position — the TP/SL applies to your full position for that symbol. The trigger price type defaults to Last Price.

TP/SL can be defined using four methods:

1. Trigger Price

Set a specific price at which the TP or SL should trigger. The system displays which direction (Long/Short) the TP/SL applies to and the estimated PNL.

2. Price Change (%)

Define the TP/SL as a percentage change from the estimated entry price.

  • Long TP: Trigger Price = Entry Price × (1 + change%)

  • Long SL: Trigger Price = Entry Price × (1 - change%)

  • Short TP: Trigger Price = Entry Price × (1 - change%)

  • Short SL: Trigger Price = Entry Price × (1 + change%)

3. ROI (%)

Define the TP/SL based on the return on investment, which factors in leverage.

  • Long TP: Trigger Price = Entry Price × (1 + ROI% / Leverage)

  • Long SL: Trigger Price = Entry Price × (1 - ROI% / Leverage)

  • Short TP: Trigger Price = Entry Price × (1 - ROI% / Leverage)

  • Short SL: Trigger Price = Entry Price × (1 + ROI% / Leverage)

4. PNL (USDC)

Set the TP/SL based on a specific profit or loss amount in USDC.

  • Long: Trigger Price = PNL / Order Size + Entry Price

  • Short: Trigger Price = Entry Price - PNL / Order Size

Setting TP/SL on Positions

You can add or modify TP/SL on an existing position from the position panel. When setting TP/SL on a position:

  • You can choose Entire Position mode or specify a custom size (Partial mode).

  • Trigger price type supports both Last Price and Mark Price.

  • The system displays estimated PNL based on the trigger price and current position parameters.

TP/SL Behavior in One-Way Mode

In One-Way mode, TP/SL interactions follow specific rules when new orders are placed:

  • Adding to a position (same direction): Existing TP/SL is preserved. If the new order also has TP/SL, the new settings override the existing ones.

  • Closing/reversing a position (opposite direction): If the existing position has TP/SL, those TP/SL orders are automatically cancelled when the position is closed.

  • Partial close: Existing TP/SL remains active and applies to the remaining position.

Execution

When a TP/SL is triggered, it submits a Market Order to close the position (or the configured portion). Standard slippage protection applies.

Last updated