Skip to content

Position sizing#

Three modes. Pick one per strategy.

risk_pct — Risk % of balance#

HookTrader computes the entry qty so a stop-out costs a fixed percentage of your USDT balance.

qty = (balance × risk_pct%) ÷ (entry − sl)   (longs)
qty = (balance × risk_pct%) ÷ (sl − entry)   (shorts)
Setting Required? Notes
risk_pct yes Float, > 0. Typical values 0.5%–2%.
Entry sl in payload yes Without an SL, risk can't be computed.

If allow_no_sl is on, risk-based sizing is disabled — fall back to from_indicator or fixed_qty.

After computing qty, HookTrader rounds down to the symbol's LOT_SIZE step. If the rounded qty would be below MIN_NOTIONAL, the entry is rejected with quantity_below_minimum.

from_indicator — qty from the alert#

Your indicator includes qty in the entry payload. HookTrader uses it as-is (after lot-size rounding).

{
  "v": 2,
  "type": "entry",
  "symbol": "BTCUSDT",
  "ts": 1735862400000,
  "side": "long",
  "entry": 50000,
  "sl": 49000,
  "qty": 0.05
}

Use this when your indicator already does Kelly / volatility / portfolio-level sizing and you want HookTrader to be a dumb executor.

Variation: send risk_usd (per-trade USDT risk) instead of qty. HookTrader divides by SL distance to get qty.

fixed_qty — always the same size#

Configured per-strategy. HookTrader ignores any qty in the payload.

qty = fixed_qty   (lot-rounded)

Useful for very small accounts where percentage-based sizing produces sub-lot values, or for one-shot strategies you want strictly bounded.

Lot-size rounding#

All three modes round qty down to the symbol's stepSize (from Binance's LOT_SIZE filter). If rounding produces zero qty, the entry is rejected — visible in Notifications with reason quantity_rounded_to_zero.

If you see this on a risk_pct strategy, either your risk_pct is too low for the symbol's lot size, or your SL distance is too wide. The fix is usually a tighter SL or a higher risk %.

Mode is frozen at entry#

Like the rest of the strategy, the sizing mode is captured onto the trade at entry time. Changing it mid-trade doesn't affect any in-flight trade.

Slippage handling#

Independent of sizing — see slippage_adjustment on the strategy:

  • preserve_distance (default) — SL and TP are interpreted as distances from the requested entry. The fill price shifts every level by the same offset so the risk distance from the actual fill matches the alert. Best for risk-based sizing or ATR-derived SLs.
  • preserve_price — SL and TP are absolute prices, placed verbatim regardless of fill slippage. Best when SLs are drawn at chart S/R or liquidity levels.

If HookTrader cannot confirm the fill price, the position is automatically closed rather than risk placing brackets against an unknown entry.