Modify TP/SL

This section documents the modify_tpsl action

This action is used to set and replace your position's take-profits and stop-losses for a specified coin.

  • If new take-profits are provided, any previously existing TPs for that position will be canceled

  • If new stop-losses are provided, any previously existing SLs for that position will be canceled


Example Request

This example modifies the current open BTC position TP/SL using a 0% stop-loss (break-even), a 2% take-profit, an additional 1% partial take-profit with 25% size, and another additional fixed 120,500 take-profit with 50% size.

{
  "action": "modify_tpsl",
  "coin": "BTC",
  "tp_pct": 2,
  "sl_pct": 0,
  "tps": [
    {"price_pct": 0.01, "size_pct": 0.25},
    {"price": 120500, "size_pct": 0.5}
  ],
  "bot_id": BOT_ID,
  "api_key": "API_KEY"
}

coin*

This required parameter indicates which coin to use for the action.

"coin": "BTC"

Take-Profit & Stop-Loss

These parameters allows you to add position take-profit and stop-loss orders.

  • Position TP/SL orders will market-close the entire position when triggered (even if its size has increased)

  • Percentage-based TP/SL are calculated based on entry prices (not ROE %)

sl_pct

This parameter specifies the % from entry to modify your stop-loss.

  • A value of 0.01 is equal to a 1% stop-loss

"sl_pct": 0.01

tp_pct

This parameter specifies the % from entry to modify your take-profit.

  • A value of 0.01 is equal to a 1% take-profit

"tp_pct": 0.01

sl

This parameter specifies a direct price to modify your stop-loss.

"sl": 62500

tp

This parameter specifies a direct price to modify your take-profit.

"tp": 72500

Multiple Take-Profit & Stop-Loss

These parameters allows you to place multiple take-profit and stop-loss orders.

  • Additional TP/SL orders will market-close a percentage of the current position size

tps

This parameter allows you to place multiple take-profit orders.

  • You can specify TPs using a percentage from entry or a direct price:

    • A tp_pct value of 0.01 is equal to a 1% take-profit

    • A tp value of 120500 indicates a direct price to place your take-profit.

  • A size_pct value of 0.5 will close 50% of your order

"tps": [
    {"tp_pct": 0.01, "size_pct": 0.5},
    {"tp": 120500, "size_pct": 1}
]

sls

This parameter allows you to place multiple stop-loss orders.

  • You can specify SLs using a percentage from entry or a direct price:

    • A sl_pct value of 0.01 is equal to a 1% stop-loss

    • A sl value of 120500 indicates a direct price to place your stop-loss.

  • A size_pct value of 1 will close 100% of your order

"sls": [
    {"sl_pct": 0.01, "size_pct": 0.5},
    {"sl": 120500, "size_pct": 1}
]

delay

This parameter specifies a number of seconds to wait before triggering the action

  • A value of 5 is equal to a 5 seconds delay

  • Max. allowed delay is 10 seconds

"delay": 5

Last updated

Was this helpful?