TradingView webhooks8 min readPublished Aug 30, 2026

TradingView Webhook Automation: From Alert to Broker

A practical guide to designing, testing, and operating a TradingView webhook workflow without treating an alert as a guaranteed fill.

By HexTrade1,676 wordsSources reviewed Aug 30, 2026
A TradingView alert moving through validation, risk checks, broker routing, and reconciliation

Understand what a webhook does—and what it does not do

TradingView webhook automation converts an alert event into an HTTP request that another system can validate and route toward a broker. It does not prove that the strategy condition was sensible, that the broker accepted the instruction, or that a fill occurred. Treat alert creation, request delivery, order acceptance, and execution as separate observable events.

The workflow begins inside a TradingView indicator or strategy. When the configured condition becomes true, TradingView assembles the alert message and sends it to the webhook URL. A receiver such as HexTrade then has to parse the message, identify the intended account, map the chart symbol to a broker instrument, apply configured controls, and submit an instruction through the broker's supported interface.

Those boundaries matter during diagnosis. A chart marker with no delivery record points to a different problem than a delivered request with a broker rejection. Likewise, an accepted order may remain working, fill in pieces, or be cancelled. The safest mental model is a chain of state transitions rather than a single button that magically turns a signal into a position.

  • Signal state: the Pine condition and alert frequency determine when a message is created.
  • Transport state: TradingView records whether its webhook request was sent successfully.
  • Application state: the receiver records validation, routing, and risk-control decisions.
  • Broker state: the broker remains authoritative for orders, fills, and positions.

Execution is not guaranteed

Network delivery, a valid payload, and broker acceptance are all necessary but still do not guarantee a fill or a particular fill price.

The alert-to-order control path
Pine condition
A confirmed chart condition determines whether an alert should be emitted.
TradingView alert
TradingView formats the configured message and sends an HTTP request.
Webhook validation
The receiver authenticates the route and validates the payload contract.
Risk and routing
Account, symbol, quantity, and order instructions are checked and translated.
Broker lifecycle
The broker can accept, reject, cancel, partially fill, or fill the order.
Reconciliation
Logs and broker state are compared before another action is taken.
The alert-to-order control path. Each boundary has a different responsibility; a successful alert is not the same event as an accepted or filled order.

Design the TradingView alert deliberately

A reliable alert has one clearly defined condition, an intentional evaluation frequency, a stable message, and a documented version. Decide whether the condition may trigger intrabar or only after bar close, because that choice can change signal behavior. Recreate alerts whenever their underlying script, inputs, symbol assumptions, or message contract materially changes.

Pine alerts can originate from an indicator, a strategy order-fill event, an alertcondition call, or an alert call. Those mechanisms are not interchangeable. Strategy calculations, recalculation settings, and alert frequency affect when a condition is evaluated. Read TradingView's current Pine alert documentation and test the exact script configuration instead of inferring behavior from a plotted shape alone.

TradingView stores a snapshot of the script and inputs when an alert is created. Editing the chart afterward should not be assumed to update the running alert. Give each production alert a human-readable name that includes the strategy version, timeframe, and environment, then record the same identifier in your execution notes. That simple convention makes stale alerts much easier to find.

  1. 1

    Freeze the signal definition

    Document the script version, symbol, timeframe, session, inputs, and whether confirmation at bar close is required.

  2. 2

    Choose one event meaning

    Make the alert represent a specific intent such as entry, exit, or risk reduction rather than several ambiguous actions.

  3. 3

    Create and label the alert

    Use a versioned name and paste the private webhook URL only into the alert's webhook field.

  4. 4

    Retire stale copies

    Disable superseded alerts so two versions cannot act on the same account unintentionally.

Build a small, explicit payload contract

The payload should contain only the fields the receiver documents, with unambiguous types and enumerated actions. Keep credentials out of the body, validate account and symbol identifiers, and include a stable event identifier when the receiving workflow supports one. Reject malformed or unknown instructions instead of guessing what the sender meant.

Valid JSON is useful because it preserves field names, numbers, strings, and booleans predictably. It is not enough for a message merely to look like JSON in the alert dialog; quote rules and dynamic Pine values can still produce malformed output. Start with the smallest payload accepted by the current HexTrade documentation and add optional controls one at a time.

A payload is also a versioned interface. Renaming an action or changing a quantity from a number to a string can break downstream validation. Store a redacted sample beside the strategy version and test it against a non-production or dry-run path when available. Never place broker passwords, API secrets, personal data, or reusable authentication tokens in an alert message.

Illustrative structure only—use the current HexTrade field names and allowed values from the webhook documentation.
{
  "eventId": "strategy-version:event-sequence",
  "platformType": "documented-platform-value",
  "accountId": "documented-account-identifier",
  "ticker": "documented-symbol",
  "action": "documented-action",
  "quantity": 1
}

Protect the webhook route

Treat a private webhook URL as a credential. TradingView also advises against sending login credentials or passwords in webhook bodies.

Define order, position, and risk semantics before testing

An action such as buy or sell is incomplete unless the workflow defines whether it opens, adds, reduces, reverses, or closes exposure. Document quantity units, order type, time in force, protective-order behavior, symbol mapping, and the response to an existing position. Conservative defaults should fail closed when account or instrument state is uncertain.

The chart symbol is not always the broker's tradable symbol. Futures contracts expire, data vendors use different continuous-contract conventions, and brokers may require a specific contract identifier. Symbol mapping must therefore be reviewed around contract transitions and tested for every market. The receiver should never silently route an unknown chart ticker to a guessed instrument.

Protective instructions also require lifecycle rules. Decide whether stops and targets are attached, submitted separately, or managed by another system; what happens after a partial fill; and who cancels orphaned children. Avoid having a Pine alert, a broker bracket, and a separate copier all manage the same exit unless their ownership and precedence are explicitly designed.

Questions that turn an alert into a complete order instruction
DecisionDocument before deploymentUnsafe assumption
Position effectOpen, add, reduce, close, or reverseEvery buy only opens a new long
QuantityContracts and maximum allowed sizeThe receiver will infer risk from account equity
InstrumentExact broker contract and roll procedureA continuous chart ticker is directly tradable
ProtectionStop/target owner and partial-fill behaviorOne submitted bracket solves every failure state

Test in stages with observable acceptance criteria

Begin with payload validation, then a simulated or non-production account when available, and finally the smallest exposure your plan permits. A test passes only when the chart event, webhook record, receiver decision, broker order, fill state, and resulting position agree. One successful request is not enough to validate duplicate, rejection, partial-fill, and restart behavior.

Create a test matrix before enabling an alert. Include a valid entry, a valid exit, malformed JSON, an unknown account, an unmapped symbol, an out-of-range quantity, duplicate delivery, and a broker rejection. The expected response for each case should be written down. This turns testing into evidence rather than an informal check that the happy path appeared to work.

Reconciliation is the final assertion. Compare the receiver's execution log with the broker's order and position records, including timestamps and identifiers, without expecting them to use identical labels. If any state is unclear, stop the test and resolve it manually. Scaling while an unexplained mismatch exists converts a small diagnostic issue into an account-level risk.

  1. 1

    Validate only

    Confirm schema, authentication, account lookup, and symbol mapping without intentionally creating exposure.

  2. 2

    Exercise broker states

    Observe acceptance, rejection, cancellation, partial-fill handling, and position reconciliation in the safest available environment.

  3. 3

    Use minimum planned size

    If moving to a live account, use the smallest size allowed by the written risk plan and monitor the full lifecycle.

  4. 4

    Record and review

    Save redacted event and order identifiers, note the result, and fix every unexplained discrepancy before expansion.

Operate the workflow as a controlled system

Production operation requires alerts for failures, searchable event records, duplicate protection, position reconciliation, and a documented kill procedure. Diagnose from the earliest missing state: signal, delivery, validation, submission, broker acceptance, fill, or position. Pause automation after unexplained divergence rather than repeatedly resending an instruction whose eventual status is unknown.

TradingView publishes separate guidance for webhook configuration, delivery errors, and resubmission behavior. Review those documents because delivery behavior can change and because automatic resubmission makes idempotent processing important. A repeated event identifier should not create unintended duplicate exposure; the receiver should return or record the prior outcome when it can safely identify the same event.

Operational ownership must be explicit. One person or runbook should know how to disable the TradingView alert, revoke or rotate the webhook route, cancel working broker orders, flatten only when appropriate, and preserve logs. After script edits, credential changes, broker maintenance, contract rolls, or prolonged downtime, rerun the relevant validation cases before restoring unattended operation.

  • Start with TradingView's alert log when no request appears downstream.
  • Use receiver validation details when delivery succeeded but routing did not.
  • Use the broker order identifier for acceptance, cancellation, and fill questions.
  • Compare positions after reconnects, retries, manual trades, and partial fills.
  • Keep a manual shutdown path that does not depend on the failing component.

Sources and methodology

HexTrade Research uses official product, exchange, regulator, and vendor documentation. Policies and platform behavior can change; follow the linked source and verify current terms before trading.

  1. 1.How to configure webhook alerts TradingView, accessed Aug 30, 2026
  2. 2.Webhook resubmission TradingView, accessed Aug 30, 2026
  3. 3.What webhook errors mean TradingView, accessed Aug 30, 2026
  4. 4.Using credentials for webhooks TradingView, accessed Aug 30, 2026
  5. 5.Pine Script alerts TradingView, accessed Aug 30, 2026
  6. 6.TradingView webhook automation HexTrade Docs, accessed Aug 30, 2026
  7. 7.Webhook troubleshooting HexTrade Docs, accessed Aug 30, 2026
  8. 8.Symbol mapping HexTrade Docs, accessed Aug 30, 2026

Frequently asked questions

Does a successful TradingView webhook mean my order filled?

No. It only indicates progress in request delivery. The receiver can still reject the payload, the broker can reject or cancel the order, and a working order may never fill. Confirm the broker's order and position state.

Should I put broker credentials in the alert JSON?

No. Use the receiver's documented account reference and keep passwords, API secrets, and reusable tokens out of TradingView messages. Treat the private webhook URL itself as sensitive and rotate it if exposed.

Why can an alert differ from the marker on my chart?

The running alert uses its saved script-and-input snapshot, while the open chart may have different code, settings, data, or recalculation state. Alert frequency and intrabar behavior can also change the observed event timing.

How should duplicate webhook deliveries be handled?

Design for idempotency. Use a stable event identifier when supported, retain prior outcomes, and avoid blindly resubmitting an instruction with unknown broker status. TradingView's current retry documentation should inform the receiver's duplicate window.

What is the safest first live test?

Complete validation and simulation first. If a live test is still appropriate, use the smallest exposure allowed by your plan, watch the complete lifecycle, and stop immediately if logs and broker state do not reconcile.

Next step

Put the research into a controlled workflow

Start small, verify the broker and account rules, and keep risk controls between every signal and live order.

Explore webhook automation

Continue reading

Educational content only. Futures are leveraged products and can produce losses greater than the amount you expected to risk. This article is not financial, legal, or prop-firm compliance advice.