Skip to content

Examples#

Copy / paste / tweak. All examples assume tps[] carries the matching number of TP prices in the entry payload.

Default — break-even at TP1, trail at TP2, full exit at TP3#

{
  "tp1": [{ "type": "move_sl_be" }],
  "tp2": [{ "type": "activate_trail" }],
  "tp3": [{ "type": "close_position" }]
}

This is the default template for trend-following indicators that fire 3 TPs.

Aggressive partial-take#

Take 30% off at TP1 and TP2, hold the runner to TP3.

{
  "tp1": [
    { "type": "move_sl_be" },
    { "type": "reduce_position", "percent": 30 }
  ],
  "tp2": [
    { "type": "move_sl_pct", "percent": 0.3 },
    { "type": "reduce_position", "percent": 30 },
    { "type": "activate_trail" }
  ],
  "tp3": [{ "type": "close_position" }]
}

The reduce_position at TP1 sells the first 30% before the trail is armed, locking in profit.

Pyramid scale-in#

Add to the position at TP1 once momentum is confirmed, then trail from TP2.

{
  "tp1": [
    { "type": "move_sl_be" },
    { "type": "add_to_position", "percent": 50 },
    { "type": "move_sl_pct", "percent": 0.5 }
  ],
  "tp2": [
    { "type": "move_sl_pct", "percent": 0.2 },
    { "type": "activate_trail" }
  ],
  "tp3": [{ "type": "close_position" }]
}

Note the explicit move_sl_pct after add_to_position — without it, the resting SL only protects the original qty. See add_to_position warnings.

Strategy-managed (no exchange algo orders)#

Cancel exchange-side TPs at TP1 so subsequent management runs through webhook events and HookTrader's autonomous price tracking.

{
  "tp1": [
    { "type": "cancel_algo_orders" },
    { "type": "move_sl_be" },
    { "type": "reduce_position", "percent": 50 }
  ],
  "tp2": [
    { "type": "move_sl_pct", "percent": 0.3 },
    { "type": "activate_trail" }
  ],
  "tp3": [{ "type": "close_position" }]
}

Trade-off: full control over partials and trail levels at the cost of losing the exchange-side TP3 safety net. If HookTrader is temporarily unavailable, the position has no upper bound.

Tight scalp — close everything at TP1#

{
  "tp1": [{ "type": "close_position" }]
}

Single TP, no SL management, no trail. Best for very fast indicators where TP1 is the only meaningful exit.

Conservative — BE only, no partials#

{
  "tp1": [{ "type": "move_sl_be" }],
  "tp2": [{ "type": "close_position" }]
}

Move SL to break-even at TP1, full exit at TP2. No partials, no trail. Trivial to reason about; good for backtesting parity.

See also#