Skip to main content

How to Fix a TradingView Alert Message with AI

A TradingView alert fires. NinjaTrader does not produce the expected trade. Usually the alert message is wrong: missing instrument month, wrong account, malformed JSON, or an action the receiver does not recognize. This tutorial walks fixing the alert message with an AI agent.

Direct answer

Use the TradingView Webhook Signal Analyzer for offline syntax checks, or paste the alert message and the receiving payload into an MCP-connected agent and ask it to identify the gap.

Prerequisites

RequirementDetail
CrossTrade subscriptionElite
CrossTrade Add-Onv1.13.0 or higher
MCP clientAny
Scopemcp:read for diagnosis (no writes needed)

Step 1: Pull the signal history

In your AI client:

Pull TradingView webhook signals on <account> for the last hour. For each
signal, show the parsed action, instrument, quantity, account, and outcome.
Flag any signal that produced no order or was rejected.

The agent calls GetSignalHistory. The response shows what CrossTrade received and how it parsed it.

Step 2: Identify the failure pattern

Common patterns:

Symptom in signal historyFix
symbol: "MES" (no contract month)Update the alert message to include the contract: "MES 06-26"
account field empty or wrongSet the account name in the alert message
action: "buy" but receiver expects place_marketUse the action verb the receiver recognizes
Malformed JSONRe-emit the alert with valid JSON
Duplicate signals seconds apartAdd a "once per bar" guard in the Pine Script

Step 3: Ask the agent to suggest a corrected payload

Based on the failure pattern above, write a corrected TradingView alert
message for this strategy. Use the action verb CrossTrade expects, include
the contract month, and set the account to <account>. Show me the message
before I paste it into TradingView.

The agent produces a corrected message.

Step 4: Test offline

Paste the corrected message into the TradingView Webhook Signal Analyzer. The analyzer shows how CrossTrade will interpret it without contacting your add-on.

Step 5: Update the TradingView alert

  1. Open the alert in TradingView.
  2. Replace the message with the corrected version.
  3. Save.
  4. Fire a test alert from TradingView's "Send test webhook" action.

Step 6: Re-pull signal history

Pull the TradingView signal from the last 2 minutes on <account>. Tell me
whether it produced an order and the outcome.

The agent should report it as filled (or correctly rejected for a stated reason).

Common TradingView alert message gotchas

  • Pine Script {{ticker}} placeholder. Includes the root symbol on most charts, not the contract month. For futures, hardcode the contract month or use a per-chart placeholder that includes it.
  • JSON quoting. TradingView passes the message as a single string. Escape quotes correctly when the message is JSON.
  • Account name case. CrossTrade's account matcher is exact. Sim101 and sim101 are different.
  • "Once per bar close" alerts. If the strategy logic relies on barstate.isconfirmed, an alert set to "Once per bar" can fire on the wrong bar.