Pinescript 多策略.exit 为一入口
我尝试为一个条目创建两个不同的strategy.exit函数(其中一个用于限制,另一个用于停止)。因为我想从这两个退出函数中获取不同的注释。
相关代码片段:
strategy.entry("Longi" , direction = strategy.long, limit = close + 5)
strategy.exit("LongKapa" , from_entry = "Longi" , limit = xxx)
strategy.exit("LongKapa" , from_entry = "Longi" , stop = xxx)
但是策略测试人员忽略了第二个。那么,在 if 块中不使用strategy.order 的情况下如何获得两个不同的注释呢?
I try to create two different strategy.exit function for one entry(one of them is for limit, other one is for stop). Because I want to take different comments from these two exit function.
Related code snippet:
strategy.entry("Longi" , direction = strategy.long, limit = close + 5)
strategy.exit("LongKapa" , from_entry = "Longi" , limit = xxx)
strategy.exit("LongKapa" , from_entry = "Longi" , stop = xxx)
But strategy tester neglect second one. So how can I get two different comments without using strategy.order in if block ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该为其提供唯一的 ID,否则您将
修改
而不是创建
新的。https://www.tradingview.com/pine-script -reference/v5/#fun_strategy{dot}退出
You should give it unique id's otherwise you will
modify
and notcreate
a new one.https://www.tradingview.com/pine-script-reference/v5/#fun_strategy{dot}exit
使用逻辑
或
。适用于布尔表达式。Use logical
or
. Applicable to boolean expressions.strategy.exit
为此目的提供了专用的注释参数:comment、comment_profit、comment_loss、comment_trailing
,这些参数根据触发退出的条件使用。检查帮助以获取详细信息,但在您的示例中您将使用:strategy.exit
has dedicated comment arguments for that purpose:comment, comment_profit, comment_loss, comment_trailing
, which are used based on the condition, which triggered the exit. Check help for details, but in your example you'd use: