Page 1 of 1

Alert for atomate trading

Posted: Wed Nov 02, 2022 11:57 am
by carloden26@gmail.com
To all members, have a nice day

who sees my problem?

I want alerts for a bot in 3commas but when i save the script i get the error: Compilation error, Line 37: no viable alternative at character ´{¨
Line 37 is the first alert.

// Enter positions
if buyCondition
strategy.entry(id="Long", direction=strategy.long)
alert({ "message_type": "bot", "bot_id": 9990121, "email_token": "4479d3b1-1b4d-4fd6-****************f2d", "delay_seconds": 0}), alert.freq_once_per_bar_close
if buyCondition[1]
buyPrice := open

// Exit positions
if sellCondition or stopCondition
strategy.close(id="Long", comment="Exit" + (stopCondition ? "SL=true" : ""))
buyPrice := na
alert({ "action": "close_at_market_price", "message_type": "bot", "bot_id": 9990121, "email_token": "4479d3b1-1b4d-4fd6-af9e-42d8954f1f2d", "delay_seconds": 0}), alert.freq_once_per_bar_close
// Draw pretty colors
plot(buyPrice, color=color.lime, style=plot.style_linebr)
plot(stopPrice, color=color.red, style=plot.style_linebr, offset=-1)
plot(ma1, color=color.blue)
plot(ma2, color=color.orange)Image

Re: Alert for atomate trading

Posted: Sun Nov 13, 2022 7:05 am
by purplemint22
I think you have to use the escape character in the alert message.

So instead of this

alert({ "action": "close_at_market_price", "message_type": "bot", "bot_id": 9990121, "email_token": "4479d3b1-1b4d-4fd6-af9e-42d8954f1f2d", "delay_seconds": 0}), alert.freq_once_per_bar_close

You would go something like this

alert({/ "action"/: "close_at_market_price", "message_type"/: "bot", "bot_id"/: 9990121, "email_token"/: "4479d3b1-1b4d-4fd6-af9e-42d8954f1f2d", "delay_seconds"/: 0}), alert.freq_once_per_bar_close

This is going to be correct by itself because I can't test this, but it should change the color of the colons and other characters when the escape character is used correctly.