我一直试图发送警报,其中应该包含进入价格,利润,损失在一个单一的消息(基本上是一个括号的订单格式)。到目前为止,我是通过两个不同的信息得到它。一个是在strategy.entry()期间,另一个是在strategy.exir().可以一起寄吗?
发布于 2020-06-26 12:09:10
LucF,
使用以下代码达到要求。
'strategy.entry("Enter Short", strategy.short, 1, when = TradingTime, alert_message = 'Profit=' + tostring(high[1]-low[1]) + 'Loss=' + tostring(high[1]-low[1]) )'
场所持有者{{strategy.order.alert_message}}传递所需的值。:)
谢谢您使用alert_message.的指导
发布于 2020-06-15 20:52:24
按每个顺序使用alert_message=,但使strategy.exit()中的一个为空,然后使用{{strategy.order.alert_message}}占位符配置您的警报。
发布于 2020-12-17 03:02:06
你可以试试这样的东西。创建两种不同的消息,一条用于购买,另一条用于销售&然后在Tradingview脚本中使用相应的消息。然后,在输入调用中编码的警报消息将在警报消息中被捕获。由于您正在寻找括号顺序,您可以添加其他参数,如盈亏,以下列格式。
buy_msg = "TYPE:LE "+" :SYMBOL: "+syminfo.ticker +" :PRICE: "+tostring(close)+" :QTY: "+tostring(quant)
sell_msg = "TYPE:Lx "+" :SYMBOL: "+syminfo.ticker +" :PRICE: "+tostring(close)+" :QTY: "+tostring(quant)
strategy.entry("Long", strategy.long, when = buy,comment="Buy",alert_message=buy_msg )
strategy.entry("Short", strategy.short, when = sell,comment="Sell",alert_message=sell_msg)在最后一步中,需要将消息指定为{{strategy.order.alert_message}}。请参阅附呈的截图。

https://stackoverflow.com/questions/62368484
复制相似问题