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():
{
"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 → Target | Action |
|---|---|
0 → +Q | one BUY order, size Q |
+Q → +2Q | one BUY order, size Q |
+2Q → 0 | one SELL order, size 2Q, automatically reduce_only |
+2Q → −Q | two orders: SELL 2Q (reduce_only) to close + SELL Q to open short |
0 → 0 | no 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:
{
"action": "buy",
"symbol": "BTCUSDT",
"quantity": 0.01,
"price": "{{close}}",
"order_type": "market",
"reduce_only": false
}Change "action" to "sell" for sell signals.
Field Reference
| Field | Required | Values | Description |
|---|---|---|---|
action | Yes (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 |
symbol | Yes | e.g., "BTCUSDT" | Trading pair in Binance format. Exchange prefixes like BINANCE:BTCUSDT are automatically stripped |
quantity / contracts | Yes (Signal) | Number | Trade 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_size | Yes (Strategy) | SIGNED Number | Strategy only. Target position to hold AFTER this signal: positive = long, negative = short, 0 = flat |
price | No | Number or "{{close}}" | Price for limit orders. Also used as entry price for TP/SL calculation in Signal Mode |
order_type | No | "market", "limit" | Defaults to the webhook's configured order type if omitted |
order_id | No | String | Optional identifier — logged for tracking purposes |
comment | No | String | Optional comment — saved in the execution log |
reduce_only | No (Signal) | true, false | Signal Mode only. If true, only reduces an existing position. Ignored in Strategy Mode — Amabit derives it from position_size |
position_side | No | "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:
| Placeholder | Value |
|---|---|
{{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:
| Accepted | Not accepted |
|---|---|
BTCUSDT | BTC/USDT |
ETHUSDT | ETH-USDT |
BINANCE:BTCUSDT | SOL/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:
{
"action": "buy",
"symbol": "BTCUSDT",
"quantity": 0.005,
"price": "{{close}}",
"order_type": "limit"
}Reduce-Only (Futures)
Close an existing position without opening a new one:
{
"action": "sell",
"symbol": "BTCUSDT",
"quantity": 0.01,
"order_type": "market",
"reduce_only": true
}Hedge Mode — Close Long Position
{
"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:
{
"action": "buy",
"symbol": "ETHUSDT",
"order_type": "market"
}