Man Nguyen
Man Nguyen

Reputation: 153

Pinescript convert series string to const string

I'm trying to create an alertcondition having trouble with the message argument, my message I want it to contain some of my variable value something like

str.format("{0} just broken recent high {1}, new high is {2}", syminfo.ticker, prev_hi, cur_hi)

However this will output a series string but alertcondition message argument expects a const string. I tried to look through the document but cannot seem to find any function to convert a series string to const string.

Is it possible to achieve such behaviour with alertcondition or do I have to use alert?

Upvotes: 1

Views: 8886

Answers (1)

beeholder
beeholder

Reputation: 1699

series variables cannot be converted into const variables. You need to either use the alert() function, which allows for series strings, or to pass your variables to plots and then reference these plots with placeholders as described here.

Upvotes: 3

Related Questions