{{alertcondition.message}} does not work:
My Alert Script (pineversion=5):
INalIDAMlong = input.string("long", title="long Alert", group="Alert Messages")
INalIDAMshort = input.string("SHORT", title="SHORT Alert", group="Alert Messages")
long = ta.rising(CCI,100)
short = ta.falling(CCI,-100)
ALLalertsmessage = long? INalIDAMlong : short? INalIDAMshort : na
alertcondition(ALLalerts, title='ALL X-Alerts L/S', message='ALLalertsmessage')
The script works, but when I receive an alert, the message always says "ALLalertsmessage" and not "long" or "SHORT" as intended.
Do you have any idea what I'm doing wrong, or is this feature simply not provided by TradingView? Thank you!
You are passing ALLalertsmessage
as a string and not a variable when you put it between single quotes as you do like 'ALLalertsmessage'
. So, it will just print whatever text is between the single quotes.
However, alertcondition()
is not suitable for your use because it is not that dynamic. You can only do a limited number of things with it.
If you want dynamic alert messages, you the alert()
function instead.
if (ALLalerts)
alert(ALLalertsmessage)