Custom Alerts & Webhooks
The ctx.alert() and Pine alert() functions let you fire custom notifications, sounds, and outgoing webhooks when conditions trigger, while v1.0.6 adds structured log.* console telemetry with clickable chart bar navigation.
Triggering Alerts
Alerts are evaluated dynamically on the current bar. The engine handles deduplication automatically so historical backtest passes do not flood the notification tray.
// JavaScript Mode: trigger an alert when RSI dips below 30
const rsi = ctx.ta.rsi(ctx.bars.map(b => b.close), 14);
const isOversold = rsi[ctx.bars.length - 1] < 30;
ctx.alert("RSI is Oversold! Buy Signal generated.", isOversold);
// Direct Pine Mode (v1.0.6)
if rsiVal < 30
alert("RSI is Oversold on " + syminfo.ticker)
Webhook Integration
If you connect a Webhook URL in your terminal settings, any triggered ctx.alert(message, true) or Pine alert(...) call dispatches a JSON payload to your server:
{
"symbol": "BTCUSD",
"timeframe": "15m",
"message": "RSI is Oversold! Buy Signal generated.",
"price": 64500.50,
"timestamp": 1721245000000
}
Alerts vs. Pine Logs (log.*) (v1.0.6)
Use alert() / ctx.alert() for real-time toasts and outgoing webhooks, and use v1.0.6 Pine Logs (log.info(), log.warning(), log.error()) for multi-bar historical debugging:
- Captures up to
MAX_SCRIPT_LOGS = 500historical messages synced live viacl:script-logs. - Supports
{0}placeholder interpolation and filter queries using the Pine Logs pill, timestamp bounds, or#barindex search. - Clicking any Pine Log row centers and highlights that exact bar on the chart canvas, with a Back to Script Editor / Dismiss (Esc) restore banner.