0

I'm trying to send Custom variable value using plot function inside pine-script.

plot(0.42, title="SL")
alertcondition(condition=b_long , title='L', message='msg_{{plot("SL"}}_{{close}}')

This works only when i dont have long pine-script, more than ~400 lines of code.

Problem is that tradeview does not replace {{plot("SL")}} with value that is circulated inside pine-script. and the message i got is msg_{{plot("SL"}}_8873.34 instead of msg_0.42_8873.34 I have encounters strange problem that makes problem only when i have pinescript is long

Do you have similar problem? Any ideas how to solve it? Posting Support Ticketing on tradeview is currently impossible.

1
  • Finally after a lot of experimenting i have figured, that Tradingview exposes only first 19 plot variables to alarms. So the variables after {{plot_19}} or{{plot("mva200")}} are not evaluated.
    – lepi
    Commented Jul 17, 2020 at 20:42

1 Answer 1

2

I had the exact same issue and tested all kinds of stuff. In the end I rebuild a simple new study with sending the most simple custom variable to an alert and it worked (magically). After that I added the code from the study that didn't work and for some reason it now works. This feels like a bug, because there is literally no difference between the 2 study's. Hope this works for you as well!

Edit: The only difference is now that all the indicators are now plotted below the graph. Not sure that makes a difference.

1
  • Still an issue in 2024. I have to set overplay=false, add the indicator to the chart, then create an alert, and wait for it to be triggered. After that, set overplay back to true, and it starts to work.
    – Peter
    Commented Jan 20 at 4:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.