将变量添加到 pinescript 中的警报 [英] Adding variables to alerts in pinescript

查看:196
本文介绍了将变量添加到 pinescript 中的警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 TradingView 中的几只股票的 pine 脚本中使用相同的警报条件.问题是,除非我创建脚本的副本并为每个脚本自定义消息,否则我不知道哪个股票触发了警报.我想要类似的东西:

I would like to use the same alert condition in a pine script for several stocks in TradingView. The problem is that I won't know which stock triggered the alert unless I create copies of the script and have a custom message for each script. I would like to have something like:

alertcondition(someCondition, title='Bullish', message=tickerid)

我使用tickerid变量,它是内置变量的松树脚本之一.但是,当我尝试这样做时,我得到的消息实际上是tickerid,而不是与脚本关联的图表的tickerid.有没有办法动态生成tickerid?

where I use the tickerid variable which is one of pine scripts built in variables. However, when I attempt this, the message I get is literally tickerid instead of the tickerid of the chart associated with the script. Is there any way to dynamically generate the tickerid?

推荐答案

刚刚偶然发现您的问题,以防其他人也这样做:将变量添加到 alertcondition<的 message/code> 已经有一段时间了.例如:

Stumbled upon your question just now and in case anyone else does too: Adding variables to the message of an alertcondition has been possible for a while. For example:

  • {{exchange}}
  • {{ticker}}
  • {{close}}
  • {{volume}}

(来源)

PS Kodify.net 有一个详尽的教程:https://kodify.net/tradingview/alerts/alert-variables/

PS Kodify.net has a thorough tutorial on this: https://kodify.net/tradingview/alerts/alert-variables/

这篇关于将变量添加到 pinescript 中的警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆