Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Pine Script Alert Debugger

    1

    Debug Pine Script alert triggers and validate webhook JSON payloads to prevent trading execution errors.

    Free

    8 usesSecurity scanned
    Pine Script Alert Debugger

    Pine Script Alert Debugger

    Example session with this skill installed

    My alert fires too often and 3Commas says the JSON is invalid. Code: alertcondition(longCondition, title="Buy", message='{action: buy, price: ' + str.tostring(close) + '}')

    • Read your context and instructions
    • Compiled the pine script alert

    I have analyzed your Pine Script alert logic and identified issues with the payload structure and trigger frequency.

    [Pine Script Alert Debug Report]

    🚨 Alert Trigger Issues:

    • Missing barstate.isconfirmed check. This alert will fire on every tick where the condition is met, even if the bar hasn't closed, leading to "repainting" alerts.
    • High frequency risk: The current logic does not restrict the alert to once per bar.

    📡 Webhook Payload Validation:

    • Invalid JSON: The keys and string values are missing double quotes (").
    • Syntax Error: Using string concatenation inside the message parameter is less reliable than using TradingView's placeholder syntax for webhooks.

    🔔 Duplicate Fire Prevention:

    • Missing freq or once parameter in alertcondition(). In the UI, this defaults to "Only Once," but programmatic logic should ideally handle state to prevent spamming.

    ️ The Fix:

    // Add barstate check to your condition logic
    longConfirmed = longCondition and barstate.isconfirmed
    
    // Corrected alertcondition with valid JSON payload and placeholders
    alertcondition(longConfirmed, 
         title="Buy", 
         message='{"action": "buy", "price": "{{close}}", "ticker": "{{ticker}}"}')
    

    [Self-Check]

    • Alert trigger conditions validated for barstate and timing
    • Webhook payload syntax checked for valid JSON
    • Duplicate fire prevention verified
    • Corrected code provided with proper parameters

    Next steps

    1. Update your script with the barstate.isconfirmed logic to ensure the candle is closed.
    2. Copy the new JSON payload into your TradingView alert settings box.
    3. Perform a test fire on a lower timeframe to confirm 3Commas accepts the new format.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    TradingView alerts that fire on unconfirmed bars or send malformed JSON payloads lead to failed executions and costly trading errors. Troubleshooting these "silent" failures in live scripts is difficult and time-consuming.

    What it does

    • Analyzes alertcondition() and alert() functions for repainting issues and barstate logic errors.
    • Validates webhook JSON payloads for syntax errors, unescaped characters, and missing fields.
    • Identifies logic flaws that cause duplicate alerts or alert spamming across multiple bars.
    • Verifies that dynamic variable references in messages will return valid values at execution time.

    Frameworks & tools

    Pine Script (v4 and v5), TradingView, and webhook integrations for 3Commas, Alertatron, and custom automation tools.

    Why this beats prompting it yourself

    General LLMs often overlook Pine Script-specific barstate nuances, such as the importance of barstate.isconfirmed to prevent repainting. This skill follows a rigorous checklist specifically designed for the execution quirks of the TradingView alert engine.

    Use cases

    • Preventing alerts from firing multiple times on the same candle during high volatility.
    • Ensuring webhook payloads are compatible with third-party execution platforms.
    • Fixing alerts that "vanish" because conditions only briefly met on an unconfirmed tick.

    Known limitations

    Requires Pine Script source code to analyze trigger logic. Cannot verify server-side webhook reception issues outside of TradingView.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Trading & Investing.

    Requires access to the Pine Script source code. Cannot diagnose external server issues or broker-side execution failures beyond the alert payload itself.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    8 uses

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 12 days ago

    • Free with an Agensi account

    Permissions

    Read Files
    Write Files
    Network Access
    Listed2 months ago
    Updated12 days ago

    What's inside

    Frequently Asked Questions

    This skill specializes in detecting Pine Script-specific issues like repainting alerts on unconfirmed bars, malformed JSON syntax in webhook messages, and logic errors that cause duplicate executions or "silent" failures.

    Yes, it is fully compatible with both Pine Script v4 and v5, including support for the newer `alert()` function and legacy `alertcondition()` triggers.

    Simply provide the script logic and the alert message template; the skill will analyze the code for execution risks and validate that your dynamic variables are formatted correctly for your specific webhook receiver.

    The skill includes pre-configured validation templates for popular trading automation platforms like 3Commas and Alertatron, ensuring your payloads meet their specific formatting requirements.

    No, this skill is designed to debug the script logic and payload structure within TradingView; it cannot troubleshoot external server outages or API connectivity issues on your execution platform.

    You receive the specialized AI agent skill capable of performing deep logic audits on your alerts, along with a structured checklist for verifying webhook compatibility across different trading environments.

    New in Trading & Investing

    Free