【问题标题】:In tradingview alert, when using {{strategy.order.comment}}, my comment is not showing but instead the strategy order id在 tradingview 警报中,当使用 {{strategy.order.comment}} 时,我的评论没有显示,而是策略订单 ID
【发布时间】:2023-01-31 02:54:13
【问题描述】:

在 tradingview alert 中,当使用 {{strategy.order.comment}} 时,我的评论没有显示,而是策略订单 ID,为什么会这样?下面是确切的脚本。

strategy.entry(id="Short", direction=strategy.short, stop=ShortEntry, comment="{"alertId": "ea581e08-d600-4fd9-b6a6-9185cfd5f737"}")

使用 {{strategy.order.comment}},我希望警报消息显示 {"alertId": "ea581e08-d600-4fd9-b6a6-9185cfd5f737"} 但警报消息显示为“短”。我有将这个类似的脚本用于其他警报并且工作正常但是这个特定的行为很奇怪......请帮忙!

我尝试更改评论字段以进行任何更改但没有成功(仍然只显示 id 部分..)

【问题讨论】:

    标签: alert tradingview-api


    【解决方案1】:

    一般来说,使用cmets对于图表,和警报消息通过 webhook 发送字符串

    像这样的东西:

    if shortCondition
        strategy.entry(
          'Short',
          strategy.short,
          stop = ShortEntry,
          alert_message = '{"alertId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"}')
          comment = 'Short')
    

    您可以使用占位符{{strategy.order.alert_message}},但我认为在这种情况下没有必要

    【讨论】:

      猜你喜欢
      • 2021-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多