问题描述
我希望在警报条件中包含一个文本变量.我正在使用 alertcondition(scr_label!="" ,title="1.Screener ALert",message="Screener Alert:"+scr_label)
I wish to include a text variable in the alertcondition.I am using alertcondition(scr_label!="" ,title="1.Screener ALert",message="Screener Alert:"+scr_label)
此处 scr_label 是一个动态文本变量,我希望警报将其作为警报消息提供给我.但是,如果在没有任何消息的情况下触发警报.
Here scr_label is a dynamic text variable and I want the alert to give me that as the alert message. However if fires an alert without any message.
我怎样才能做到这一点?
How can I achieve this?
推荐答案
文档中详细说明
帮助中心•警报•警报设置• 如何在警报中使用变量值一个>
Help Center•Alerts•Alerts settings• How to use a variable value in alert
在警报中生成可变文本的能力非常有限.我无法在警报中输出字符串变量.在以下代码段中,解决方法是如何在警报中输出颜色类型变量.
The ability to generate variable text in alerts is very limited. I couldn't output a string variable in the alerts. In the following snippet, a workaround is how tooutput a color type variable in an alert.
plot(ColorS == #FF8C00 ? 1 : -1, title="colorA", display=display.none)
alertcondition(cross(LagFF,LagFS) and ColorF==ColorS, title='LagF', message='LagF cross {{ticker}} {{interval}} Up/Down {{plot("colorA")}}' )
通过他们的支持票务系统向 TradingView 提出功能请求.我认为可以添加占位符 {{label}}.
Leave a feature request with TradingView via their support ticketing system. I think it is possible to add a placeholder {{label}}.
[添加]
现在你可以这样做了
if scr_label!=""
alert("Screener Alert:"+scr_label, alert.freq_once_per_bar_close)
这篇关于Pinescript:在警报中使用文本变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!