Get a sound, a message or a notification when a price is reached or a script says so, with the chart open or closed.
Open Alerts in the bar on the right of the chart to see every alert in one list: price alerts first, then the alerts of your scripts and what fired lately. Use the search box, the type and the status to narrow the list. All symbols shows the price alerts of every symbol, not only the one on the chart.
A price alert watches one symbol and tells you when its price reaches a level you chose. Press Create alert, or right-click the chart and choose Add alert at … (or press Alt + A). It runs on CAM even when the chart is closed, and you get it as a notification.
On the chart an alert is a dashed line with its name and price. Drag the label to move the level, click it to select the alert in the list, or press × to delete it. Right-click the line, or its row in the list, to edit, duplicate, mute, hide the line or delete. You can have up to 100 price alerts.
A script can raise alerts in two ways. alertcondition names a condition you can pick later, and alert sends a message straight from the code. Alerts run while the chart is open. To keep one running with the chart closed, switch on Run on server (see below).
alertcondition
alert
//@version=6 indicator("Alert Example", overlay = true) len = input.int(20, "Length", minval = 2) mid = ta.sma(close, len) plot(mid, "Average", color.blue) crossUp = ta.crossover(close, mid) crossDown = ta.crossunder(close, mid) plotshape(crossUp, "Up", shape.arrowup, location.belowbar, color.green) plotshape(crossDown, "Down", shape.arrowdown, location.abovebar, color.red) // Create alerts from these in the Alerts panel. alertcondition(crossUp, "Price crossed above", "Price crossed above the average") alertcondition(crossDown, "Price crossed below", "Price crossed below the average") // Or fire straight from the script, once per bar. if crossUp alert("Price crossed above the average", alert.freq_once_per_bar_close)
Add the script to the chart, then open Alerts in the bar on the right. Under New script alert choose the script, choose Any alert() call or one of its alert conditions, pick how often it may fire, and press Add script alert. When it fires you see a message on the chart, hear a short sound and, if you switched on Browser notification, get a notification even when the tab is in the background.
An alert applies to every symbol and timeframe where the chart runs the script. Under Symbol and Timeframe you can limit it to the ones the chart shows now.
Next to each alert, Run on server keeps it running on CAM with the chart closed. It runs on the symbol and timeframe of the chart, with the inputs the script has on the chart now, and you get it as a notification in CAM. Under On the server you see each one, whether it is running, how many it sent and, if it stopped, why.
For alert calls, the script chooses: alert.freq_once_per_bar, alert.freq_once_per_bar_close or alert.freq_all.
alert.freq_once_per_bar
alert.freq_once_per_bar_close
alert.freq_all