'Tradingview Pine script alert message not working

first of all i dont know much about coding so keep that in mind. :)

I created a strategy in Tradingview and i would like to create an alert for it that displays a specific message for Capitalize AI to trigger buy/sell or close positions.

for example for capitalize ai a webhook message looks like something like this :

{"alertId": "e351d512-ffc7-40ac-af940-661eb8af2e43"}

The message has to look like exactly like this otherwise capitalize ai wont recognize it.

So my problem is this.

for example if i write the strategy. entry like this:

strategy.entry(id="Buy", long=true, when=enterLong(), alert_message = "Hello Everybod")

When the strategy "buys" the alert message will display Hello Everybody,

But if i insert the webhook message in Pine Script like this :

strategy.entry(id="Buy", long=true, when=enterLong(), alert_message = "{"alertId": "e351d512-ffc7-40ac-af940-661eb8af2e43"}")

the alert for the strategy should display the webhook message, but i guess because of the brackets inside the message the whole strategy script is just not working anymore and it displays an error message :

line 176: required (...)+ loop did not match anything at character 'b'

My question is, is there some way to get it to work?

Thank you for your answers.



Solution 1:[1]

Use single quotes:

strategy.entry(id="Buy", long=true, when=enterLong(), alert_message = '{"alertId": "e351d512-ffc7-40ac-af940-661eb8af2e43"}')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrey D