TradingView webhooks10 min readPublished Sep 18, 2026Updated Aug 30, 2026

Common Pine Script Futures Webhook Mistakes

Fix event logic, JSON construction, alert snapshot, symbol mapping, tick math, duplicate behavior, and security mistakes that derail futures webhooks.

By HexTrade2,000 wordsSources reviewed Aug 30, 2026
Pine editor checklist catching trigger, JSON, symbol, quantity, tick, and credential errors before a webhook

What are the most common Pine futures webhook mistakes?

The recurring mistakes are choosing the wrong alert primitive, firing on a condition that stays true, forgetting that running alerts use old snapshots, building invalid JSON, routing the chart symbol instead of the broker symbol, confusing ticks with dollars, trusting dry-run or HTTP success as a fill, and exposing credentials or private webhook URLs. Review each boundary independently before live use.

These defects compound. A broad `close > average` condition can emit repeatedly; a qualifying receiver 5xx can then resend each event; an incorrect quantity or symbol can amplify the result across a live account. Fixing only the JSON would leave the event defect intact. A prevention checklist should move in causal order: decide what event exists, decide when it may emit, construct the message, validate the route, calculate exposure, and verify external execution.

Most failures are observable before money is involved. TradingView exposes alert events and Webhook status, Pine can render test messages, and HexTrade documents `dryRun: true` for planned validation without sending an order. Use those tools to reject ambiguity. A live smallest-size test remains necessary because dry mode cannot prove broker authorization, current contract availability, order support, protective behavior, or a fill.

  • Event mistake: source creates too many, too few, or the wrong kind of alerts.
  • Contract mistake: JSON or documented fields do not mean what the author assumes.
  • Market mistake: chart context and destination instrument are not equivalent.
  • Evidence mistake: an upstream success is promoted into a downstream fill claim.
Seven review gates catch most webhook defects1Event and timingChoose one Pine trigger…2Message and routeRender valid JSON with t…3Risk semanticsReview quantity, tick-ba…4Security and evidenceKeep credentials out, us…
Seven review gates catch most webhook defects. A message should pass event, timing, syntax, route, instrument, risk, and security review before live execution.

Mistake 1: choosing the wrong Pine alert primitive

Do not use `alertcondition()` as a strategy trigger, do not use an early `alert()` when the intent requires a strategy emulator fill, and do not enable both alert calls and order fills for one external order. Choose `alertcondition()` for named indicator conditions, `alert()` for dynamic programmable messages, or strategy order-fill events for simulated fills, then test only that path.

`alertcondition()` creates functioning triggers in indicators, requires global scope, and accepts a constant message with supported placeholders. `alert()` works in indicators and strategies, executes where its local code path is reached, and accepts a dynamic series string. Strategy order-fill events require a strategy and occur when TradingView's broker emulator executes a simulated order. Each can produce useful JSON, but their event timing and alert-dialog configuration differ.

A common double fire combines an `alert()` when `strategy.entry()` is called with an alert configured for both alert calls and order fills. The first message represents order creation logic; the second represents the later simulated fill. If both reach the same live-order endpoint, one strategy action can become two external attempts. Assign one trigger source per external intent and route diagnostic alerts somewhere that cannot place trades.

Trigger choice review
NeedCorrect starting primitiveFrequent mistake
Named indicator Long and Short choices`alertcondition()`Expecting runtime string concatenation or using it in a strategy
Calculated JSON from indicator or strategy logic`alert()`Calling it from a broad condition on every eligible update
Route after TradingView's simulated strategy fillOrder-fill event with `alert_message`Treating the emulator event as a live broker fill

Mistake 2: ignoring frequency, repainting, and snapshots

A condition that remains true is not a one-time transition, an intrabar value can disappear after bar close, and editing the current chart does not update a running alert. Use transition logic or explicit state, choose confirmed-bar timing when required, inspect realtime behavior, and delete and recreate the alert after any reviewed script, input, symbol, timeframe, or message change.

`close > ema` can be true on many consecutive bars, while `ta.crossover(close, ema)` identifies a transition. For complex state, track whether the strategy is already long, short, pending, or flat, and define an explicit reset. Alert frequency limits eligible emissions but cannot turn a poor condition into a correct state machine. TradingView also documents that more than fifteen alerts in three minutes causes further alerts to halt, so bursts can create both duplicate orders and missing later notifications.

Realtime bars contain fluid values. Once-per-bar-close reduces alerts that disappear from the historical chart after reload, but waiting for confirmation changes timing and may not fit every strategy. Document the choice. Then remember the server copy: TradingView captures a snapshot at alert creation. Version payload labels and keep an alert inventory so an old strategy does not continue routing after a visible chart update.

  • Transition: prove one event when state changes.
  • Frequency: prove eligible calls within each realtime bar.
  • Repainting: compare intrabar intent with confirmed historical appearance.
  • Snapshot: prove the active server alert carries the reviewed version.
Transition and confirmed-bar gating instead of a persistent condition
//@version=6
indicator("Reviewed transition event", overlay = true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
newLong = ta.crossover(fast, slow) and barstate.isconfirmed

if newLong
    alert('{"ticker":"MNQ","action":"buy","quantity":"1","platformType":"projectx","accountId":"replace_with_exact_account_id","strategyName":"cross-v3","dryRun":true}', alert.freq_once_per_bar_close)

Mistake 3: validating Pine source instead of rendered JSON

Validate the exact alert body after Pine concatenation and TradingView placeholder replacement. Valid JSON requires double-quoted keys and string values, correct commas, escaped text, and valid representations for every dynamic value. TradingView sends `application/json` only when the final message parses as JSON; otherwise it uses `text/plain`, which a JSON endpoint can reject without a qualifying retry.

Pine does not provide a built-in JSON serializer. Every quote, backslash, comma, and conversion is the script author's responsibility. A long branch can work while a short branch omits a comma. A strategy label can include a quote. A calculation can become `na`. Test all directions, exits, minimum and maximum quantities, optional fields, and error branches. Copy a sanitized rendered body into a parser without including the endpoint token or credentials.

Types should be intentional. HexTrade's public examples quote several placeholder values and accept documented fields, but do not assume arbitrary coercion. Use one stable convention backed by current docs and dry-run tests. Avoid manually interpolating JSON around free-form user input. If the receiver returns 4xx for malformed data, TradingView's documented 5xx resubmission does not apply; syntax must be corrected and a new reviewed event created.

Small valid body used as the parser baseline
{
  "ticker": "MNQ",
  "action": "buy",
  "quantity": "1",
  "platformType": "rithmic",
  "accountId": "replace_with_exact_account_id",
  "strategyName": "json-baseline-v1",
  "dryRun": true
}

Content type is a syntax signal

A body that looks JSON-like can still be sent as `text/plain` when invalid. Parse the rendered body and inspect the TradingView delivery result before changing receiver code.

Mistake 4: mixing platform, account, and symbol contexts

Use the lowercase HexTrade `platformType`, exact `accountId` copied from Accounts, and the symbol the connected broker account actually trades. Do not infer the account from platform name or send a chart ticker blindly. When analytical and destination symbols differ, use the documented `symbolOverride`, constrain the result with `allowedSymbols`, and retest every contract roll.

HexTrade's troubleshooting docs identify wrong platform slug, account mismatch, and ticker mismatch as common failures. Its symbol guide distinguishes futures roots such as NQ and MNQ from CFD names such as NAS100 and documents venue-specific mapping. Those strings can represent different products, not cosmetic aliases. Quantity, tick value, session, and margin must be reviewed whenever mapping changes the destination instrument.

Continuous futures charts add lifecycle risk. They support analysis across contracts but do not remove expiration from the broker route. Define who chooses the destination contract and when the mapping rolls. Because TradingView alerts retain a chart snapshot, updating the visible chart is not enough. Inventory active alerts, receiver mappings, working orders, and positions before a roll, then validate the new destination with dry mode and minimum live size.

  1. 1

    Copy exact route values

    Take platform and account identifiers from current HexTrade account configuration.

  2. 2

    Name the destination product

    Verify the symbol or contract shown by that connected broker account.

  3. 3

    Constrain the mapping

    Use explicit override and allowlist fields for approved source-to-destination pairs.

  4. 4

    Revalidate lifecycle changes

    Treat contract roll, broker change, and product-class change as new route versions.

Mistake 5: confusing contracts, ticks, points, and dollars

Treat `quantity` as routed size and HexTrade's `tp` and `sl` as tick counts. A tick count is not a dollar amount or absolute price, and its economic value depends on the exact contract and quantity. Verify current exchange specifications, calculate exposure explicitly, set `maxQty` as a hard request cap, and test protective behavior at the destination broker.

Copying `sl: 20` from one market to another can produce a different price distance and money risk. Full-size and micro contracts also differ, so changing NQ to MNQ or ES to MES requires more than a string replacement. Write a worksheet with minimum tick, tick value, intended price distance, resulting tick count, quantity, and aggregate exposure. Align dynamic Pine calculations with the destination, not an unrelated chart context.

A `maxQty` guardrail catches a single oversized request but does not account for repeated webhooks, open positions, or copy-trading multipliers. `allowedSymbols` constrains instruments but not exposure. Protective fields express intent and may face broker support, rejection, market movement, or partial fills. Verify actual entry and protective orders in the destination account; a successful dry run proves only the planned request.

Risk-unit mistakes
Payload conceptCorrect questionUnsafe assumption
`quantity`How many units will this exact route attempt?The placeholder always equals the desired live size
`tp` / `sl`How many destination-contract ticks are intended?The number is dollars, points, or an absolute price
`maxQty`What is the maximum size of one request?It limits aggregate position or duplicate count
Copy multiplierWhat whole-contract result occurs per follower?Equal multiplier guarantees equal exposure or P&L

Mistake 6: exposing secrets or misunderstanding retries

Never place broker logins, passwords, API secrets, or personal information in a TradingView webhook URL or message. Keep the HexTrade private endpoint confidential and regenerate it if exposed. Also design for TradingView's exact retry rule: only HTTP 500–599 except 504 qualify, with three resends after the initial delivery. A timeout does not safely mean no order.

TradingView explicitly warns that alerts are not designed to carry credentials. Pine source, alert dialogs, screenshots, exports, and support messages can all expose body content. Use the private authenticated endpoint supplied by HexTrade and leave broker secrets in the platform's protected account connection. Redact the full URL in every artifact; knowing only that it is HTTPS does not make its embedded token public.

Retry myths create order risk. A malformed 4xx request is not automatically retried under the published rule, while a qualifying 5xx can create four total deliveries. A 504 is specifically excluded. A request cancelled after the three-second deadline may still have reached a receiver that continued work. Correlate repeated arrivals, make the execution path idempotent where supported, and reconcile unknown broker state before manual replay.

  • 2FA is required for TradingView webhook alerts.
  • Only ports 80 and 443 are accepted.
  • The remote server has a three-second response deadline.
  • Qualifying 5xx responses can produce four total deliveries; 504 is excluded.

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.Pine Script alerts TradingView, accessed Aug 30, 2026
  2. 2.Pine Script alerts FAQ TradingView, accessed Aug 30, 2026
  3. 3.How to configure webhook alerts TradingView, accessed Aug 30, 2026
  4. 4.Webhook resubmission TradingView, accessed Aug 30, 2026
  5. 5.Using credentials for webhooks 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
  9. 9.Position and risk management CME Group, accessed Aug 30, 2026

Frequently asked questions

Why does my Pine alert fire more than once?

The condition may remain true across bars or ticks, multiple alert calls or running alerts may be eligible, or a qualifying 5xx may cause repeated HTTP deliveries. Compare distinct TradingView events with delivery attempts, then fix transition logic and receiver idempotency separately.

Why does changing Pine code not change my existing alert?

TradingView saves a server-side snapshot of the script, inputs, chart symbol, and timeframe at alert creation. Later changes do not update it. Delete and recreate the alert after review, then confirm its versioned rendered payload.

Can I use single quotes for JSON keys and strings?

No. JSON requires double quotes around keys and string values. Pine may use single quotes to delimit its own source string, but the resulting webhook body must contain valid JSON double quotes and pass parsing after every dynamic replacement.

Can I send the same `tp` and `sl` to every future?

Not safely by assumption. HexTrade interprets them as tick counts, and contracts differ in tick size, tick value, volatility, and quantity. Calculate and approve each destination instrument's protection and verify current exchange specifications.

Is a TradingView success message enough to enable larger size?

No. Sender success proves only an upstream boundary. Reconcile the HexTrade record and actual broker order, fill, quantity, symbol, and protection. Scale only after positive and negative tests plus an observed smallest-size end-to-end result.

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.