I would like to use the same alert condition in a pine script for several stocks in TradingView. The problem is that I won't know which stock triggered the alert unless I create copies of the script and have a custom message for each script. I would like to have something like:
alertcondition(someCondition, title='Bullish', message=tickerid)
where I use the tickerid variable which is one of pine scripts built in variables. However, when I attempt this, the message I get is literally tickerid instead of the tickerid of the chart associated with the script. Is there any way to dynamically generate the tickerid?
Unfortunately, message of alertcondition cannot be dynamic at the moment. First, 'tickerid' is a function that is executed on a server side. Second, the alertcondition message is an entity that does not go to the indicators server engine. It's a static text message that should be displayed when alert triggers. This is how it works, hopefully it will be improved in the future releases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With