【问题标题】:Reference trade direction in alert message?在警报消息中参考交易方向?
【发布时间】:2020-09-23 04:20:57
【问题描述】:

是否有使用{{ }} 方法在警报消息中引用交易方向的内置方法?在收到消息后我没有时间点击并找到正确的图表以找出它是什么(在短时间框架内交易并且事情进展迅速);我只想在警报通知中看到它。

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    是的。查看参考资料:

    带有“strategy”前缀的占位符只能用于策略警报:

    {{strategy.position_size}} - returns the value of the same keyword in Pine, i.e., the size of the current position.
    {{strategy.order.action}} - returns the string “buy” or “sell” for the executed order.
    {{strategy.order.contracts}} - returns the number of contracts of the executed order.
    {{strategy.order.price}} - returns the price at which the order was executed.
    {{strategy.order.id}} - returns the ID of the executed order (the string used as the first parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order).
    {{strategy.order.comment}} - returns the comment of the executed order (the string used in the comment parameter in one of the function calls generating orders: strategy.entry, strategy.exit or strategy.order). If no comment is specified, then the value of strategy.order.id will be used.
    {{strategy.order.alert_message}} - returns the value of the alert_message parameter which can be used in the strategy's Pine code when calling one of the functions used to place orders: strategy.entry, strategy.exit or strategy.order. This feature is only supported in Pine v4.
    **{{strategy.market_position}} - returns the current position of the strategy in string form: “long”, “flat”, or “short”.**
    

    【讨论】:

    • 谢谢,好的!现在我的另一个问题是:交易结束后我似乎收到了同样的信息(这令人困惑!)。我想这就是为什么我们更喜欢警报指标而不是策略?或者是否有可能抑制关闭消息?我可以为此创建另一个问题,但我认为随便问一个问题会很好。再次感谢 =)
    • 是的,这是使用策略的一个缺点,因为一旦平仓,它会发送一个消息,表明该仓位要么持平,要么处于另一个方向。
    • {{strategy.order.action}} 也返回 'close'no?
    猜你喜欢
    • 1970-01-01
    • 2014-03-16
    • 2012-10-05
    • 1970-01-01
    • 2012-09-06
    • 2013-02-19
    • 1970-01-01
    • 1970-01-01
    • 2017-04-13
    相关资源
    最近更新 更多