Key points
- TradingView produces alerts; a separate system must receive, verify and act on them.
- Alerts evaluated intrabar can fire on conditions that disappear by the candle's close.
- A webhook receiver must authenticate messages and reject replays and duplicates.
- On AlgoStok the signed signal API runs in dry-run mode only and live order placement is disabled.
Alerts, conditions and Pine Script
A TradingView alert watches a condition on a chart: price crossing a level, an indicator crossing a value, or a condition coded in Pine Script, TradingView's scripting language. Pine scripts come in two broad forms. Indicators calculate and plot values and can expose alert conditions. Strategies simulate entries and exits on the chart and can raise alerts when their simulated orders fill.
Alert frequency settings matter. An alert can trigger once, once per bar, or only once per bar close. 'Once per bar close' waits for the candle to complete, which reduces false triggers at the cost of acting later.
Bar-close timing and repainting
While a candle is forming, its high, low and close keep changing. A condition such as 'close above the moving average' may be true mid-bar and false at the close. If an alert fires intrabar, the chart may later show no signal at that bar. This is one form of repainting.
Other repainting sources include scripts that request higher-timeframe data without care, and indicators that revise past values. Signals that repaint make chart history look cleaner than what an automated system would actually have received.
Webhooks and message payloads
When an alert has a webhook URL, TradingView sends an HTTP POST request to that address with the alert's message as the body. Users commonly write the message as JSON so the receiver can parse it. Placeholders let the message include values such as the ticker, the close price or the time.
| Field | Purpose |
|---|---|
| Strategy and version | Identifies which rules produced the signal |
| Symbol and exchange | Avoids ambiguity between instruments |
| Action | Enter long, exit, and so on; never an open-ended instruction |
| Bar time | Lets the receiver reject stale or out-of-order signals |
| Unique signal identifier | Lets the receiver ignore duplicates |
A message should describe what happened on the chart, not carry account details or credentials. Quantity and risk limits are better decided by the receiving system, which knows the account.
Securing the receiving server
A webhook URL is reachable from the internet, so anyone who learns it can send requests. A receiver that places orders must therefore treat every request as untrusted until verified.
- Authenticate each message, for example with an HMAC signature computed from a shared secret and the message body.
- Reject replays: require a recent timestamp and remember identifiers already processed.
- Validate every field against an allow-list of strategies, symbols and actions.
- Apply risk checks such as quantity caps and daily loss limits before anything reaches a broker.
- Log every request and decision so failures can be investigated.
Plain secrets placed inside a message body are visible to anyone who can see the alert configuration, so signature-based schemes are generally stronger.
Latency and what TradingView does not do
Between a candle closing and an order reaching an exchange there are several delays: the chart's data feed, alert evaluation, webhook delivery, the receiver's processing, the broker's API and the exchange. Each can vary, so automated systems should measure them independently rather than assume a fixed delay.
TradingView webhooks do not by themselves place orders with Indian brokers. Some brokers integrate directly with TradingView's trading panel for manual trading; automated webhook trading needs a separate receiver connected to a broker API under the applicable rules described in the algorithmic trading guide.
How AlgoStok relates to TradingView
AlgoStok's strategies were written in Pine Script and are evaluated by AlgoStok's server on closed Heikin-Ashi candles, so supported workflows do not require you to configure TradingView alerts. AlgoStok also has an HMAC-signed signal API that currently runs in dry-run mode only: signals are verified and recorded, not executed. Live order placement is disabled, and independent comparison with TradingView results is still pending. See how it works and the FAQs.
Frequently asked questions
Can a TradingView alert place an order with my Indian broker?
Not by itself. A webhook only delivers a message. A separate system connected to your broker's API would have to receive, verify and act on it, under your broker's and SEBI's rules.
Why did my alert fire but the chart shows no signal?
Most often because the alert was evaluated intrabar and the condition was no longer true when the candle closed, or because the script repaints.
Does AlgoStok execute trades from TradingView webhooks?
No. AlgoStok's signed signal API runs in dry-run mode only and live order placement is disabled.