Pine Script

Pine Script Trading Alerts: Complete 2026 Guide for TradingView

๐Ÿ“… May 9, 2026โฑ 8 min read

Pine Script trading alerts are notifications triggered by custom logic in TradingView indicators. Pine Script provides two alert mechanisms: the modern alert() function for dynamic messages, and the legacy alertcondition() for static boolean triggers.

Two Pine Script Alert Functions

FunctionVersionBest For
alert()v4+Dynamic messages with real-time variables
alertcondition()v3+ (legacy)Static text alerts

The alert() Function

//@version=6
indicator("Custom Alert", overlay=true)
rsi = ta.rsi(close, 14)
if rsi < 30
    msg = "BUY @ " + str.tostring(close)
    alert(msg, alert.freq_once_per_bar_close)

How to Avoid Repainting Alerts

  1. Use alert.freq_once_per_bar_close
  2. Wrap logic in if barstate.isconfirmed
  3. Avoid lookahead.on
  4. Test history vs real-time behavior โ€“ they should match

Webhook Integration

  1. Build alert message as JSON or HTML in Pine Script
  2. Click โฐ โ†’ Create Alert in TradingView
  3. Set Condition to "Any alert() function call"
  4. Enable Notifications โ†’ Webhook URL
  5. Paste your endpoint URL

Pine Script Alert Limits by Plan

PlanActive AlertsWebhooks
Free / Basic1โŒ No
Essential20โŒ No
Plus100โŒ No
Premium400โœ… Yes
Pro+800โœ… Yes

Common Patterns

Pattern 1: Multi-filter signal (Gold Scalpers style)

signal = isOversold and isVolumeSpike and isRangeFilter and twoGreens
if signal
    msg = '{"action":"buy","entry":' + str.tostring(close) + '}'
    alert(msg, alert.freq_once_per_bar_close)

Pattern 2: HTML formatting (Telegram)

msg = "๐ŸŽฏ <b>BUY SIGNAL</b>\n๐Ÿ“ Entry: <code>" + str.tostring(close) + "</code>"
alert(msg, alert.freq_once_per_bar_close)

See Pine Script Alerts in Action

Gold Scalpers uses production-grade alert() patterns with no repainting.

Start Free Demo โ†’