在TradingView中,Pine脚本函数策略。如果单独设置盈利和停止损失而不是单行,则无法工作
当我尝试设置止损和止盈水平时,以下代码适用于我:
strategy.exit("TP/SL 1", "Long Entry 1", stop = long_stop_level, limit = long_profit_level)
但此代码的问题是它不会告诉我这是止损退出或止盈退出。所以我尝试将其拆分按照以下方式进行:
strategy.exit("SL 1", "Long Entry 1", stop = long_stop_level)
strategy.exit("TP 1", "Long Entry 1", limit = long_profit_level)
但我注意到只有止损起作用,而止盈不起作用,无论如何我可以解决这个问题吗?
The following code works for me when I try to set the stop loss and take profit level:
strategy.exit("TP/SL 1", "Long Entry 1", stop = long_stop_level, limit = long_profit_level)
But the issue for this code is that it will not tell me it is a stop loss exit or take profit exit.. so I tried to split it off to the following manner:
strategy.exit("SL 1", "Long Entry 1", stop = long_stop_level)
strategy.exit("TP 1", "Long Entry 1", limit = long_profit_level)
But I notice that only the stop loss is working but not the take profit, is there anyway I could fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
用这个。并将显示在图表 SL 和 TP 上。请注意,我使用的是 v5
use this. and it will display on chart SL and TP. Note that i'm using v5