Skip to content

Webhook Payload Format

The payload is the JSON message that TradingView sends to your Amabit webhook when an alert fires. The format differs between Strategy Mode and Signal Mode.

Strategy Alert Payload

For TradingView strategies using strategy.entry() and strategy.close():

json
{
  "action": "{{strategy.order.action}}",
  "symbol": "{{ticker}}",
  "contracts": "{{strategy.order.contracts}}",
  "position_size": "{{strategy.position_size}}",
  "price": "{{close}}",
  "order_type": "market",
  "order_id": "{{strategy.order.id}}",
  "comment": "{{strategy.order.comment}}"
}

One-Way (Net) mode required

Strategy webhooks rely on a single net position per symbol. Hedge mode (where both LONG and SHORT positions can exist on the same symbol) is not supported — incoming signals will be rejected. Switch the account to One-Way / Net Mode on the exchange before using a Strategy webhook.

The key field is position_size — the SIGNED target position the strategy wants to hold AFTER this signal: positive = long, negative = short, 0 = flat. Amabit reads the current on-exchange position and figures out the difference:

Current → TargetAction
0 → +Qone BUY order, size Q
+Q → +2Qone BUY order, size Q
+2Q → 0one SELL order, size 2Q, automatically reduce_only
+2Q → −Qtwo orders: SELL 2Q (reduce_only) to close + SELL Q to open short
0 → 0no order — already at target

reduce_only is derived automatically from the diff and must not be set in Strategy payloads — any value is ignored. The action and contracts fields are kept for logging/debugging but the actual side and size come from position_size.

Manual Signal Payload

For custom indicators or manual alerts:

json
{
  "action": "buy",
  "symbol": "BTCUSDT",
  "quantity": 0.01,
  "price": "{{close}}",
  "order_type": "market",
  "reduce_only": false
}

Change "action" to "sell" for sell signals.

Field Reference

FieldRequiredValuesDescription
actionYes (Signal)"buy", "sell"Trade direction. You can also use side as an alternative field name. In Strategy Mode it is informational — actual side is derived from position_size
symbolYese.g., "BTCUSDT"Trading pair in Binance format. Exchange prefixes like BINANCE:BTCUSDT are automatically stripped
quantity / contractsYes (Signal)NumberTrade quantity in base currency. Not required if webhook uses "% of Balance" lot sizing. In Strategy Mode it is informational — actual size is derived from position_size
position_sizeYes (Strategy)SIGNED NumberStrategy only. Target position to hold AFTER this signal: positive = long, negative = short, 0 = flat
priceNoNumber or "{{close}}"Price for limit orders. Also used as entry price for TP/SL calculation in Signal Mode
order_typeNo"market", "limit"Defaults to the webhook's configured order type if omitted
order_idNoStringOptional identifier — logged for tracking purposes
commentNoStringOptional comment — saved in the execution log
reduce_onlyNo (Signal)true, falseSignal Mode only. If true, only reduces an existing position. Ignored in Strategy Mode — Amabit derives it from position_size
position_sideNo"LONG", "SHORT"Override the webhook's default position side. Futures Hedge Mode only — not used in Strategy Mode (Strategy requires One-Way mode)

TradingView Placeholders

TradingView replaces these placeholders with actual values at the moment the alert fires:

PlaceholderValue
{{strategy.order.action}}"buy" or "sell" (informational in Strategy Mode)
{{strategy.order.contracts}}Number of contracts/units from the strategy (informational in Strategy Mode)
{{strategy.position_size}}Strategy Mode — signed target position after this order: positive = long, negative = short, 0 = flat
{{strategy.order.id}}Order ID assigned by the strategy
{{strategy.order.comment}}Comment set in strategy.entry() or strategy.close()
{{ticker}}Symbol of the chart (e.g., "BTCUSDT" or "BINANCE:BTCUSDT")
{{close}}Current closing price
{{open}}, {{high}}, {{low}}OHLC values of the current bar
{{volume}}Current bar volume
{{time}}Current bar timestamp

Symbol Format

Amabit expects the Binance symbol format — a pair name without separators:

AcceptedNot accepted
BTCUSDTBTC/USDT
ETHUSDTETH-USDT
BINANCE:BTCUSDTSOL/USDT

TIP

If your TradingView chart uses an exchange prefix (e.g., BINANCE:BTCUSDT), that's fine — Amabit automatically strips the prefix. But formats with slashes or dashes (BTC/USDT, BTC-USDT) are not supported.

If {{ticker}} produces an unsupported format, hardcode the symbol in the payload instead.

Examples

Limit Order

Execute at the alert price instead of market:

json
{
  "action": "buy",
  "symbol": "BTCUSDT",
  "quantity": 0.005,
  "price": "{{close}}",
  "order_type": "limit"
}

Reduce-Only (Futures)

Close an existing position without opening a new one:

json
{
  "action": "sell",
  "symbol": "BTCUSDT",
  "quantity": 0.01,
  "order_type": "market",
  "reduce_only": true
}

Hedge Mode — Close Long Position

json
{
  "action": "sell",
  "symbol": "BTCUSDT",
  "quantity": 0.01,
  "order_type": "market",
  "position_side": "LONG",
  "reduce_only": true
}

Using % of Balance (No Quantity Needed)

If your webhook is configured with Custom % of Balance lot sizing, the quantity field is ignored:

json
{
  "action": "buy",
  "symbol": "ETHUSDT",
  "order_type": "market"
}

Official Binance Broker