TradingView Alert Message Format for Automated Orders (Examples)

Learn the TradingView alert message format that turns alerts into automated orders: required fields, working JSON examples, and the placeholders that make it dynamic.

Getting the TradingView alert message format right is the difference between an alert that fires reliably and one that silently fails to place a trade. TradingView can ping a webhook the instant your strategy condition triggers, but the platform on the other end only acts on what is inside the alert message. If that message is vague, malformed, or missing a field, your execution layer has nothing concrete to act on. This guide shows the exact alert message format for automated orders, with copy-ready JSON examples and the dynamic placeholders that make a single alert work across symbols and prices.

We will not tell you what to trade or when. The goal here is purely mechanical: how to structure the message so a signal becomes a correctly formed order.

Why the alert message matters

An alert and an order are not the same thing. TradingView's job ends at "the condition happened" — the alert message is the structured instruction that an execution layer reads to know what to do. If you have ever had an alert fire while no order appeared, the cause is usually the message: free-text like "BUY NOW!!!" tells a human everything and a machine nothing. A receiver needs explicit, parseable fields. We cover the broader gap between firing an alert and placing a trade in signals vs execution.

The required fields

Most execution layers, SignalToExchange included, expect a small set of fields in every alert message. At minimum you want:

  • action — the side of the order, usually buy or sell (and sometimes close).
  • symbol — the exchange trading pair, such as BTCUSDT. Use the exchange's symbol, which is not always identical to TradingView's ticker.
  • quantity — how much to trade, either a fixed size or a percentage of available balance, depending on what your tool supports.
  • order typemarket or limit; include a price field when using limit orders.

A clean JSON message is the most reliable container for these fields because it is unambiguous to parse. Plain text can work if your receiver supports it, but JSON removes guesswork.

A basic market-order example

Here is a minimal market buy. Paste this into the TradingView alert's Message box and point the webhook URL at your execution endpoint:

{ "action": "buy", "symbol": "BTCUSDT", "type": "market", "qty": "0.01" }

To exit the position, a matching sell uses the same shape with the opposite action:

{ "action": "sell", "symbol": "BTCUSDT", "type": "market", "qty": "0.01" }

A limit-order example with price

For a limit order, add the price field. You can hardcode it, but it is usually better to let TradingView fill it in dynamically (see placeholders below):

{ "action": "buy", "symbol": "BTCUSDT", "type": "limit", "qty": "0.01", "price": "{{close}}" }

Dynamic placeholders

Hardcoding every value means writing a new alert for every symbol and price. TradingView's placeholders solve this by injecting live values at fire time. The most useful ones are:

  • {{ticker}} — the current chart's ticker, handy for multi-symbol strategies.
  • {{close}} — the closing price of the triggering bar, useful for limit prices.
  • {{strategy.order.action}} — resolves to buy or sell automatically when the alert comes from a strategy rather than a plain indicator.
  • {{strategy.order.contracts}} — the position size from your strategy script.
  • {{time}} and {{timenow}} — timestamps you can pass through for logging.

A strategy-driven alert that adapts to whatever your script does looks like this:

{ "action": "{{strategy.order.action}}", "symbol": "{{ticker}}", "type": "market", "qty": "{{strategy.order.contracts}}" }

One important caveat: {{ticker}} returns TradingView's symbol, which may differ from your exchange's pair format. Confirm the symbol your exchange expects before relying on it.

Authentication and idempotency fields

Two more fields make automated messages safe in production. First, most receivers require a secret or token so they only act on alerts that are genuinely yours — never expose this publicly. Second, a unique identifier per alert lets the receiver recognize duplicates. TradingView can retry, and networks can hiccup; without deduplication, one alert can become two orders. SignalToExchange uses an idempotency key so one signal fires exactly one order, even under retries. A production-ready message might look like:

{ "token": "YOUR_SECRET", "action": "buy", "symbol": "BTCUSDT", "type": "market", "qty": "0.01", "id": "{{timenow}}" }

Best practices

  • Use JSON, not free text. Structured fields parse predictably; prose does not.
  • Match the exchange's symbol exactly. Verify the pair format on your exchange rather than assuming the chart ticker matches.
  • Validate before going live. Test with a tiny quantity, or your tool's test mode, to confirm the message parses and routes.
  • Keep your token out of shared charts and screenshots. Treat the alert message like a credential, because it carries one.
  • Include a unique id so retries are deduplicated rather than executed twice.
  • Use a trade-only API key on the exchange so a leaked key can place orders at worst, never withdraw funds. Here is how to set up trade-only API keys.

Putting it together

A good alert message is small, explicit, and structured: an action, a symbol the exchange recognizes, a quantity, an order type, a secret, and a unique id. Get those right and the alert becomes a clean, single, predictable order on your exchange. For the full wiring — creating the alert, setting the webhook URL, and connecting your exchange — follow our TradingView webhook to exchange setup guide, and if you trade on Bybit, the TradingView to Bybit automation guide walks through it end to end.

SignalToExchange is non-custodial execution infrastructure: your funds stay on your own exchange, it connects with trade-only keys, and it turns each structured alert into exactly one order. To try it with your own alerts, Request access / start your free trial →

Automated trading involves risk. SignalToExchange is execution infrastructure and does not provide financial advice, trading signals, or guarantees of any kind.

Secure Signal Routing Infrastructure

Non-custodial execution. Trade-only API keys. Independent infrastructure built for reliability.

Request Early Access

Trade-only API key enforcement. No withdrawal permissions. No custody.