Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

pine script - How to add variables to an alertcondition when your condition is a security?

I'm trying to create alerts with variables. I've seen this thread and this article, but I believe because my condition comes from a Security function, I'm having problems with creating the alerts.

s01 = input('DOTSDT', type=input.symbol)
screenerFunc() => triggerA and triggerB
c01 = security(s01, res, screenerFunc())
alertcondition(c01, title="ALERT!", "Look at " + S01)

If I try the above, I get a:

Cannot call 'alertcondition' with arguments (series[bool], title=literal string, message=input string)

If I try the following...

alertcondition(c01, title="ALERT!", message="Look at: {{ticker}}")

...I get a

Cannot use a mutable variable as an argument of the security function.


UPDATE

In fact, the issue seems to be using the security function as a condition for alertcondition rather than the use of any variable. I've tried to simply use a static message, but still get the same error Cannot use a mutable variable as an argument of the security function.

UPDATE!!!

I've created another thread, hopefully a more clear one:
“alertcondition” fails when the condition comes from a security function

Appreciate your help :-)

question from:https://stackoverflow.com/questions/65859751/how-to-add-variables-to-an-alertcondition-when-your-condition-is-a-security

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...