← BACK TO BLOG

Common Pine Script Alert Mistakes That Break Automated Execution

A strategy that backtests perfectly can still fail in live automation if its alerts aren't built correctly.

1. Alerting on the Wrong Condition

Setting an alert to "Once per bar close" instead of "Order fills" means your alert fires on a bar event, not necessarily a real strategy entry or exit.

2. Inconsistent JSON Formatting

Hardcoding a JSON message string directly is fragile — a single missing comma or quote breaks the payload entirely, and TradingView won't warn you.

3. Missing Exit Reason Fields

Strategies with multiple exit types need to clearly identify why a position closed. Without this, a bot can't distinguish a stop-out from a take-profit.

4. Not Handling Partial Exits

If your strategy scales out at TP1, TP2, and TP3, each partial exit needs its own clearly labeled payload.

5. Forgetting Symbol and Timeframe Context

If you're running the same strategy across multiple symbols, the payload needs to explicitly state which instrument the alert belongs to.

Testing Is Not Optional

Every one of these mistakes is invisible in a backtest. Before connecting any live account, send test payloads through a validator tool and confirm every action type parses exactly as expected.

Get Xiznit Bot →

Get Xiznit Bot →