alertcondition() syntax and parameters in Pine Script v6
The alertcondition() function enables an indicator to offer predefined alert events directly inside TradingViews native alert creation dialog. When a user right-clicks a chart and selects "Add Alert", any alertcondition registered by your script appears in the Condition dropdown menu. It requires a boolean series condition and optional display labels.
| Parameter | Type | Description | Example |
|---|---|---|---|
| condition | series bool | The logical expression that triggers the alert when true | ta.crossover(fastEma, slowEma) |
| title | const string | The short name displayed in the TradingView alert dropdown | "Bullish Crossover" |
| message | const string | The default notification text or webhook JSON payload | "Buy signal triggered on {{ticker}} at {{close}}" |