Skip to content

Trading9 min read

TradingView alert message reference for Hyperliquid webhooks

Every action, field and placeholder of the TradingView alert message that trades Hyperliquid, how tickers map to markets, and what each error means.

, Founder of Hypr Markets

Published

On this page

A TradingView alert message for Hyperliquid webhooks is one JSON object that TradingView sends to a webhook URL each time an alert fires. On Hypr Markets terminals with Webhooks for TradingView, message version 1 takes 9 actions (buy, sell, close, close_long, close_short, flat, cancel_all, reverse and target), a symbol such as {{ticker}}, and exactly one size field for buy and sell. Unknown fields are refused, so a typo can never place an order without its stop.

This reference is for traders who want to write or edit their alert messages by hand, and for anyone checking why a message was refused. It lists every action and field, how sizes, stops and leverage work, how TradingView tickers become Hyperliquid markets, which placeholders to use, and the exact error each common mistake produces. For a guided setup, start with how to automate TradingView alerts on Hyperliquid.

What does a TradingView alert message look like?

A TradingView alert message for Webhooks for TradingView is a JSON object with an action, a symbol and, when it opens a position, a size. TradingView's webhook page explains that a message that is valid JSON is sent with an application/json content type and anything else as plain text; the receiver accepts both, but only reads a JSON object.

{
  "id": "{{ticker}}-{{interval}}-{{timenow}}",
  "ts": "{{timenow}}",
  "action": "sell",
  "symbol": "{{ticker}}",
  "size_pct": 5,
  "order_type": "limit",
  "price": "{{close}}",
  "sl_pct": 1.5
}

This one places a limit sell at the bar's close for 5% of the account value, with a stop-loss 1.5% above the entry. Field names are lower case, and the order of fields does not matter.

Which actions can an alert message use?

The action field decides what the alert does, and nine actions cover opening, closing and cancelling. Four aliases are accepted too: long means buy, short means sell, exit means close, and close_all means flat.

ActionWhat it doesNeeds
buyOpens or adds to a long (or reduces a short)symbol, one size
sellOpens or adds to a short (or reduces a long)symbol, one size
closeCloses the position, long or short, with a reduce-only ordersymbol; optional size_pct
close_longCloses the position only if it is a longsymbol; optional size_pct
close_shortCloses the position only if it is a shortsymbol; optional size_pct
flatCancels open orders and closes every position in the webhook's marketsnothing else
cancel_allCancels open orders in one market, or in all of the webhook's marketsoptional symbol
reverseCloses the position, then opens the other waysymbol; optional size
targetMoves the account to a given position: long, short or flatsymbol, market_position, a size

close, close_long and close_short take only size_pct, the share of the position to close; without it they close all of it. reverse without a size opens the same size again.

How do you set the order size?

Buy and sell take exactly one size field, and a message with two is refused. size_usd is the order's value in dollars, size_pct is a share of the account value, above 0 and up to 100, used as notional, and size_coins is a number of coins of the market.

Sizes are rounded down to the market's size step. Hyperliquid's minimum order value is $10, so an opening order just below it is raised by one size step if that still fits the webhook's per-order limit, and refused if it does not. An order above the per-order limit is refused, never shrunk: a message that asks for $500 on a webhook capped at $100 places nothing, and the alert log says why.

size_pct uses the value of the perpetuals account, so with funds held elsewhere on Hyperliquid a percentage can come out smaller than you expect. A fixed size_usd is the most predictable choice while you start.

Market and limit orders

order_type is market unless you say limit. A market order on Hyperliquid fills immediately or not at all: it is sent as an immediate-or-cancel order priced at most slippage_bps through the mark price, so a thin book can leave it unfilled rather than filled far away. A limit order needs a price, and tif sets how long it rests: gtc (good till cancelled, the default), ioc, or alo, which only adds liquidity and is cancelled instead of crossing the book. Hyperliquid's order types page describes each one, and our post on Hyperliquid order types explains them with examples.

A market order with a price, or with a tif other than ioc, is refused, because that combination usually means a field was left over from another message.

Stop-loss and take-profit

sl and tp take a price; sl_pct and tp_pct take a percentage from the entry. Use one form of each. After an opening order, the receiver places them as reduce-only trigger orders on the whole expected position, so a later alert that adds to the position does not leave part of it unprotected. A stop on the wrong side of the entry, such as a stop above the price on a long, is refused before anything is signed. sl_pct goes up to 90 and tp_pct up to 1,000.

One edge to know: when the entry is a limit order that has not filled yet, Hyperliquid can refuse a stop or target for a position that does not exist. The order then stands, the stop step shows as failed, and the alert is marked partly done. A market entry avoids it.

A reduce-only order cannot carry a stop or a target, and the receiver refuses that combination.

Leverage, margin, reduce-only and slippage

leverage sets the market's leverage before the order, as a whole number from 1 to 50, and never above the highest leverage the terminal allows. margin is cross, the default, or isolated. Leave leverage out to keep the current setting. reduce_only true on a buy or sell means the order can only shrink a position. slippage_bps, from 1 to 500, is the most a market order may cross the book, and the webhook's own maximum still caps it.

Leverage multiplies losses as well as gains, and a position near its liquidation price can be closed by Hyperliquid. The liquidation price calculator shows where a position would be liquidated before you set a leverage in a message.

How do id and ts stop repeated and late alerts?

id is a key of up to 128 characters. A second alert with the same id on the same webhook is ignored, whatever else it says. The generator builds one from placeholders, such as {{ticker}}-{{interval}}-{{timenow}}, so each new alert gets a new id and a resent one does not. Without an id, identical messages within the webhook's duplicate window, 10 seconds to start, are dropped.

ts is the alert's time. Set it to {{timenow}}, or to epoch seconds or milliseconds. With ts present, the webhook refuses an alert older than its maximum age, 60 seconds to start. Refused alerts and Test runs never count as seen, so they never block a real alert.

How are TradingView tickers mapped to Hyperliquid markets?

The receiver turns the symbol into a Hyperliquid market in a fixed order. The webhook's own symbol map wins first, then a Hyperliquid name given as it is, then these rules: drop an exchange prefix, drop a perpetual suffix (.P, .PERP, -PERP, PERP), drop the quote currency (USDT, USDC, USD, USDE, FDUSD, BUSD), read XBT as BTC, and map tickers multiplied by 1,000 to Hyperliquid's k markets.

Ticker in the alertHyperliquid market
BTCUSDT.PBTC
BINANCE:ETHUSDTETH
BYBIT:SOLUSDT.PSOL
1000PEPEUSDT.PkPEPE
XBTUSDBTC
xyz:TSLArecognised as HIP-3, refused

A ticker no rule maps is refused before anything is signed. For those, add a line such as MYTICKER=ETH to the webhook's symbol map, which holds up to 50 mappings. HIP-3 markets are refused because webhook keys trade the main Hyperliquid perpetuals only for now.

Which placeholders can a message use?

TradingView's page on variables in alerts lists the placeholders it fills in. The ones that matter here are {{ticker}}, {{close}}, {{interval}} and {{timenow}} for any alert, and for strategies {{strategy.order.action}}, {{strategy.order.contracts}}, {{strategy.order.id}}, {{strategy.market_position}} and {{strategy.position_size}}.

Always quote them, as in "price": "{{close}}", so the message stays valid JSON before and after TradingView fills it in. A placeholder TradingView cannot fill arrives unchanged, and the receiver refuses it with a clear error rather than guessing a number. Strategy placeholders are only filled for alerts on a strategy's order fills.

What do the common errors mean?

Every refused message gets an error that names the field and the problem, such as price: a limit order needs a price. The alert log in the terminal and the free checker both show the receiver's exact text, a few problems at a time, so fix them and check again. These are common ones:

ErrorCause and fix
unknown field stoplossA field name the receiver does not know; use sl or sl_pct
size: use exactly one of size_usd, size_pct, size_coinsTwo size fields; keep one
size: add one of size_usd, size_pct, size_coinsA buy or sell with no size
price: a limit order needs a priceorder_type limit without price
tif: market orders are always immediate-or-cancelA tif on a market order; remove it
size_coins: placeholder {{strategy.order.contracts}} was not filled in by TradingViewA strategy placeholder on a non-strategy alert
the alert message is not valid JSON (check quotes and commas)A missing quote or comma, often around a placeholder
symbol: flat closes every market; use close for one symbolflat with a symbol

Frequently asked questions

Is the alert message case sensitive?

Field names are lower case. Values such as the action, order_type, tif, margin and market_position are read in any case, so BUY and buy both work. Symbols are matched against Hyperliquid's market names, with the mapping rules above.

Can one alert open a position and set a stop-loss?

Yes. Add sl or sl_pct, and tp or tp_pct, to a buy, sell, reverse or target message. They are placed as reduce-only triggers right after the entry. With a limit entry that has not filled yet, Hyperliquid can refuse them, and the alert then shows as partly done.

What is the difference between close and flat?

close acts on one market, the symbol in the message, and can close part of the position with size_pct. flat takes no symbol: it cancels open orders and closes every position in the markets the webhook allows.

Can I send numbers as text?

Yes. Every number may arrive as text, such as "0.25" or "100", because TradingView fills placeholders in as text. A value that is not a number, or a placeholder that was not filled in, is refused.

Where do I put the passphrase?

In a passphrase field, when the webhook has one: "passphrase": "your phrase". It is checked against a fingerprint, never stored or logged, and removed from the stored copy of the alert. Anyone with the URL and the passphrase can send alerts to that webhook, so keep both private.

All articles