Debug a TradingView Alert All the Way to Broker Fill
A complete evidence-first runbook for tracing Pine execution, TradingView delivery, HexTrade validation, broker submission, order state, fills, duplicates, and recovery.
How do you debug a TradingView alert to broker fill?
Trace one event in order: Pine condition, active TradingView alert snapshot, alert-log event, Webhook status, rendered JSON, HexTrade execution record, exact broker account, order identifier, and final fill state. Stop at the first missing or contradictory fact. Never resend while an earlier attempt may have reached the broker, and never treat webhook acceptance as proof of execution.
Write a case key before making changes: strategy version, alert name, source chart, destination account and symbol, side, quantity, and trigger time. Redact the private endpoint and credentials. This key keeps one event separate from nearby manual trades or retries. If copy trading is involved, debug the master through fill first, then add one row per follower because follower success is not atomic.
The runbook is intentionally linear. Pine cannot explain a broker rejection, and broker screens cannot prove which alert snapshot emitted. Changing several layers at once destroys causality. Preserve screenshots or exported text before recreating alerts, refreshing charts, editing mappings, or closing orders. Unknown is a valid temporary conclusion and should trigger reconciliation rather than a plausible guess.
- Event proof: the intended server-side alert actually emitted.
- Delivery proof: the exact body reached the expected endpoint or failed with a classified sender status.
- Route proof: the receiver selected the expected account, instrument, side, and size.
- Execution proof: the broker exposes the actual order and its final known state.
Step 1: prove the Pine event and running alert
Confirm the alert log contains an event at the expected realtime moment, then verify the running alert's condition, trigger family, frequency, expiration, symbol, timeframe, and creation version. Pine code only exposes alert events; the user must create the alert. Because TradingView stores a snapshot, the visible chart and current source may differ from what the active alert executes.
If no event exists, stay in Pine. For an indicator, verify whether the selected `alertcondition()` or “Any alert() function call” path executed. For a strategy, determine whether the alert includes `alert()` calls, order fills, or both. A custom strategy order message requires `{{strategy.order.alert_message}}`. Check runtime errors and the documented burst halt of more than fifteen alerts in three minutes. Confirm that the condition occurred on a realtime bar rather than only in historical calculation.
If timing looks wrong, test repainting. Intrabar highs, lows, and closes can change before confirmation, and every-tick strategy calculations can differ from historical bars. Once-per-bar-close can align events with confirmed data but changes latency. Do not switch frequency casually during an incident. Capture the old configuration, reproduce in dry mode, approve the timing change, then recreate the server-side alert and assign a new version label.
- 1
Locate the event
Use the TradingView alert log, not a chart marker, as proof that an alert emitted.
- 2
Identify the trigger
Name the exact condition, `alert()` path, or strategy order-fill event.
- 3
Compare the snapshot
Check creation-time script, inputs, symbol, timeframe, message, frequency, and expiration.
- 4
Reproduce safely
Use dry JSON and a new versioned alert only after preserving original evidence.
Step 2: classify the TradingView webhook delivery
Read the Webhook status for the exact alert event. A 3xx indicates redirect, 4xx receiver rejection, 5xx receiving-server failure, and timeout a response beyond three seconds; URL, TLS, connection, and invalid-response errors have their own transport causes. Count qualifying 500–599 responses except 504 as possible resends, up to four total deliveries for one trigger.
Inspect the exact public HTTPS URL without exposing its private token. TradingView permits ports 80 and 443, does not support local or private destination addresses, and currently documents no IPv6 support. It sends `application/json` only when the final alert message is valid JSON; otherwise the request uses `text/plain`. A redirect to a sign-in page or a plain-text body reaching a JSON-only route can explain failure before any trade field is considered.
Timeout demands caution. The three-second limit describes sender waiting, not downstream side effects. Search receiving evidence for each attempt before retrying. TradingView's resubmission article documents three five-second resends only after qualifying 5xx responses and explicitly excludes 504. Do not generalize that behavior to DNS, TLS, connection, timeout, 3xx, or 4xx outcomes. If arrival remains unproven, preserve the ambiguity and continue with receiver and broker checks.
| Observed status | Primary investigation | Unsafe response |
|---|---|---|
| No alert event | Pine and alert configuration | Editing the webhook endpoint |
| 3xx or URL error | Exact path, DNS, proxy, and redirect | Assuming TradingView follows an authorization flow |
| 4xx | Access, content type, JSON, and documented fields | Waiting for an automatic 5xx-style retry |
| Qualifying 5xx | Receiver health and duplicate-safe event state | Treating each delivery as a new order |
| Timeout | Arrival and downstream side-effect evidence | Manual resend before broker reconciliation |
Step 3: validate the JSON and HexTrade route
Parse the rendered, sanitized body and compare it with HexTrade's current webhook docs. Verify lowercase `platformType`, exact `accountId`, destination `ticker` or `symbolOverride`, allowed side or action, quantity, tick-based `tp` and `sl`, and any window or guardrail. Confirm whether `dryRun` was true. Change only the first invalid field and retain the response.
Do not validate the Pine source string alone. Placeholder replacement and dynamic concatenation can introduce invalid quotes, commas, or values. TradingView's content type reveals whether it recognized valid JSON, but parsing a captured safe sample gives more detail. Keep credentials and the full endpoint out of validators. If syntax passes, compare semantics: a Tradovate futures account and a TradeLocker CFD account can require different symbols even when the charts represent related markets.
HexTrade documents `dryRun: true` as validation without an order, so a successful dry record should have no broker order. It also documents `maxQty`, `allowedSymbols`, sessions, custom trade windows, cooldown, and an in-memory daily cap. A guardrail rejection can be correct. Preserve which field blocked the route instead of weakening several controls to make the test pass. Then rerun dry mode with the intended exact account.
{
"ticker": "MNQ",
"action": "buy",
"quantity": "1",
"platformType": "projectx",
"accountId": "replace_with_exact_account_id",
"strategyName": "debug-case-v1",
"alertName": "manual-dry-diagnostic",
"maxQty": 1,
"allowedSymbols": ["MNQ"],
"dryRun": true
}A green dry run ends before the broker
It proves a planned route without placing an order. It cannot validate live authorization, market state, margin, prop rules, broker support, protective orders, price, or fill.
Step 4: resolve the broker order and fill state
Open the exact connected account and find the order using route, symbol, side, quantity, time, and any available broker reference. Distinguish rejected, accepted, working, partially filled, filled, cancelled, and unknown. Inspect actual filled quantity and price, not only requested values. If protective orders were requested, verify their existence and state independently from the entry.
A broker rejection should include a reason or category that directs the next check: authorization, unavailable contract, session, margin, account or firm limit, order semantics, or another destination rule. Do not keep editing JSON after the receiver selected the correct route and the broker returned a specific rejection. Resolve that account-facing cause through current broker or firm documentation. A marketable request can also remain absent if authorization expired even though previous tests worked.
Accepted and filled are separate. Limit and stop orders can work without filling, and partial fills create real exposure smaller than requested. Market orders can fill at prices different from the alert's chart value. Record state transitions until terminal or intentionally carried forward. If no matching order is found, check for wrong account and symbol before declaring loss. A nearby manual order is not automatically the webhook order.
- Rejected: no fill from that order, but preserve the exact reason and verify no alternate submission.
- Working: live order risk exists even though no fill exists yet.
- Partially filled: both position and remaining order require management.
- Filled: record actual quantity and price; then verify any attached protection.
- Unknown: pause new attempts and escalate reconciliation.
Step 5: handle duplicates and multi-account divergence
Group repeated HTTP deliveries under one TradingView event, distinguish them from separate Pine events, and map each logical event to broker submissions. Never replay an unknown event automatically. For copy trading, the webhook targets one master; reconcile its fill first, then record every follower outcome separately. Deactivate the group or pause the source when divergence exceeds the operating policy.
A qualifying 5xx can produce four deliveries for one trigger. A Pine condition that remains true can produce several triggers. A receiver retry after lost broker acknowledgement can produce multiple submissions. A human can add another replay. Count all four layers separately. Use versioned strategy labels, account, symbol, side, quantity, and sender time to correlate, while recognizing that labels alone are not a documented idempotency guarantee.
In a copy group, one follower can fill while another rejects or remains unknown. Resending the source webhook is unsafe because the master and successful followers may already have exposure. HexTrade documents per-follower multipliers and group deactivation. Use those controls within an incident plan, inspect each broker account, and resolve exposure through authorized account actions. Do not promise atomic rollback across markets or platforms.
| Evidence pattern | Likely cause | Correct next action |
|---|---|---|
| One alert event, several deliveries, one broker order | TradingView qualifying resend handled safely | Document receiver idempotency evidence and original 5xx cause |
| Several alert events from one persistent condition | Pine gating or frequency defect | Pause alert and replace with transition or state logic |
| One receiver event, several broker orders | Concurrency or unknown-state retry defect | Reconcile exposure and inspect receiver submission controls |
| Master filled, followers diverged | Per-account copy execution differences | Pause group as required and reconcile every follower |
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.How to configure webhook alerts — TradingView, accessed Aug 30, 2026
- 2.What webhook errors mean — TradingView, accessed Aug 30, 2026
- 3.Webhook resubmission — TradingView, accessed Aug 30, 2026
- 4.Pine Script alerts — TradingView, accessed Aug 30, 2026
- 5.Pine Script alerts FAQ — TradingView, accessed Aug 30, 2026
- 6.Using credentials for webhooks — TradingView, accessed Aug 30, 2026
- 7.TradingView webhook automation — HexTrade Docs, accessed Aug 30, 2026
- 8.Webhook troubleshooting — HexTrade Docs, accessed Aug 30, 2026
- 9.Symbol mapping — HexTrade Docs, accessed Aug 30, 2026
- 10.Copy trading setup — HexTrade Docs, accessed Aug 30, 2026
Frequently asked questions
Where should debugging start if no broker order appears?
Start in the TradingView alert log. If no event exists, investigate Pine and the running alert snapshot. If an event exists, read Webhook status, then move to the HexTrade record and broker account in order.
Does TradingView retry a timed-out webhook?
Its published resubmission rule covers HTTP 500–599 except 504, not a generic timeout guarantee. Treat timeout state as uncertain, inspect whether the receiver or broker acted, and do not manually resend until reconciliation is complete.
Why is the broker order working but not filled?
Acceptance and working status mean an order exists but its execution conditions have not fully occurred. Order type, price, market movement, liquidity, and session can matter. Monitor or manage it under the account procedure rather than calling it failed.
What if the master fills but a follower rejects?
Treat it as partial multi-account success. Do not resend the source alert. Pause the group if policy requires, preserve every account result, reconcile exposure, and resolve the follower's specific authorization, symbol, size, or rule issue.
When is it safe to retry a webhook trade?
Only when evidence proves the prior logical event created no broker side effect or when a documented idempotent workflow guarantees reuse of the original result. An unknown submission, timeout, working order, partial fill, or follower divergence is not safe to replay blindly.
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 automationContinue 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.