pine-scriptpine-script-v5alerts

Are alerts updated when a script is recompiled?


I have a number of TradingView alerts setup using one of my indicator scripts to generate the trigger.

If I recompile the script with some logic changes, will those changes AUTOMATICALLY update the alerts on the backend server, or do I need to recreate the Alerts?

I have recompiled a number of different scripts and I'm just not sure if the alerts are now working correctly or not. I really just want to know a bit more about how it's supposed to work.


Solution

  • You need to delete the old alert and then create a new one.

    A few weeks ago I was making a change to the alert text in my pine-script code, but afterwards the alert message was the old one. I had to delete the alert and recreate a new one for the change to be visible.

    I then searched for a reference in the pine-script docs and found confirmation here: TV concepts/alerts

    Look at the last paragraph of Introduction resp. the last bullet point:

    ... Subsequent changes to your script’s inputs or the chart will thus not affect running alerts previously created from them. If you want any changes to your context to be reflected in a running alert’s behavior, you will need to delete the alert and create a new one in the new context.