TradingView alerts
Every order starts as a TradingView alert that calls https://hooks.botedge.net with a short JSON message.
Before you start
- A paid TradingView plan: webhooks are not available on the free plan.
- Two-factor authentication turned on in your TradingView account: TradingView only sends webhooks from accounts that have it.
- A connection in your dashboard. Its card shows the webhook URL and the alert message, with a copy button for each.
Create a strategy alert
- Open the chart of the market you trade on the exchange you connected, for example
BINANCE:BTCUSDT.Pfor Binance USD-M orBYBIT:BTCUSDT.Pfor Bybit, and add your strategy. - In the strategy settings, set the order size in the unit your exchange uses for that market (see your exchange guide).
- Open Create alert, choose your strategy as the condition and select Order fills only.
- Under Notifications, tick Webhook URL and paste
https://hooks.botedge.net. - Replace the whole Message with the alert message copied from your connection card, then create the alert.
The message looks like this; the copy from your dashboard already contains your pointer:
the alert message ↓
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "{{strategy.order.action}}",
"quantity": "{{strategy.order.contracts}}",
"prev_position": "{{strategy.prev_market_position}}"
}TradingView replaces the {{...}} placeholders when the alert fires: each order of the strategy becomes an order on your account, with the same side and size.
Strategies that reverse in one order
When a strategy goes from long to short in one step, TradingView sends a single sell that closes the long and opens the short. On the exchanges where prev_position makes closing orders reduce-only (Binance futures, Bybit, Bitget, BitMart Futures, Hyperliquid Perps), that order only closes the long. Remove the prev_position line from the message if your strategy reverses this way.
Indicator and manual alerts
Alerts that do not come from a strategy have no order placeholders, so write the side and size yourself: one alert for buying and one for selling. Put your own pointer in place of YOUR_POINTER_HERE___.
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "buy",
"quantity": "0.01"
}{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"action": "sell",
"quantity": "0.01"
}To close the position on a ticker, whatever its size and side:
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "{{ticker}}",
"closeall": "true"
}Message fields
The message must be valid JSON: double quotes around every name and value, commas between fields, no comments. Numbers work with or without quotes ("0.01" or 0.01), but closeall must be the text "true".
| Field | Required | Values | What it does |
|---|---|---|---|
| pointer | Yes | Your connection's 20-character pointer | Identifies the connection, and therefore the exchange account, that places the order. |
| ticker | Yes | {{ticker}} or a symbol such as BTCUSDT | The market to trade. The .P and PERP suffixes are ignored and the closest market on your exchange is used, so alert from a chart of the same exchange. |
| action | Unless closeall is sent | buy or sell | The order side. {{strategy.order.action}} fills it in for strategies. |
| quantity | For orders | A number such as 0.01, or one * or / operation such as 0.03/3 | The order size, sent to the exchange as it is: coins on most markets, contracts on some futures. Each exchange guide says which. |
| quantity_precision | No | A whole number such as 3 | Rounds the quantity to that many decimals before sending it. |
| prev_position | No | flat, long or short | The position before this order, from {{strategy.prev_market_position}}. On Binance futures, Bybit, Bitget, BitMart Futures and Hyperliquid Perps it sends closing orders as reduce-only; on OANDA it sets how the order fills. |
| hedgemode | No | hedge | For accounts in hedge (two-way) position mode on Binance futures, Bybit, Bitget and BitMart Futures. Needs prev_position, which picks the long or short side. |
| closeall | No | "true" | Closes the open position on the ticker instead of placing an order. Leave action out. |
| type | No | market (default) or limit | The order type. A limit order also needs price. |
| price | With type limit | A number | The limit price. |
| takeprofit, stoploss | No | Prices | Take-profit and stop-loss prices attached to the order, on OANDA, Bybit, Bitget, OKX, Phemex, WooX and Polymarket Perps (orders that open or add to a position). Other exchanges may ignore them or reject the order. |
A limit order with take-profit and stop-loss, on an exchange that supports them:
{
"pointer": "YOUR_POINTER_HERE___",
"ticker": "BTCUSDT",
"action": "buy",
"quantity": "0.01",
"type": "limit",
"price": "60000",
"takeprofit": "66000",
"stoploss": "57000"
}Test before going live
- Use a Demo connection if your exchange offers a testnet or demo account, or a very small size.
- Turn on executed orders emails on the connection while testing: you get one for every order, and one for every error.
- TradingView waits about 3 seconds for an answer. If your exchange is slow, TradingView may log the webhook as failed even though the order was placed: check the email or your exchange before sending it again.
- Nothing happened and no email arrived? See when no email arrives.