TradingView Strategy Common Questions
How does TradingView Alert work?
https://www.tradingview.com/support/solutions/43000481368-strategy-alerts/
When an alert is created for a strategy, a copy of the strategy is created on our servers. This copy then runs independently from the chart's strategy in your browser, and changes to your chart's strategy will have no effect on the operation of its copy running on our servers. For any change to your chart strategy's settings to be reflected in the alert's behavior, you will need to delete the previous alert and create a new one.
Their official document says alerts will be triggered when the orders are executed in their broker emulator. "An order fill event is any event generated by the broker emulator which causes a simulated order to be executed"
strategy.entry("Long", strategy.long, stop = high, alert_message = "Stop-buy
executed (stop was " + tostring(high) + ")")
Variables included in the alert_message
argument are evaluated when the order is executed, so when the alert triggers.