Pine script TradingView中三种退出策略的冲突

Pine script TradingView中三种退出策略的冲突,pine-script,Pine Script,我制定了三种退出策略,如下所述。第一个是要使用的主要退出策略。二是突破后的利润最大化。第三个仅用于切割损耗 1. strategy.close( "Long",when = Close_Condition == true and is_breakthrough == false) // main exit strategy 2. strategy.exit("CP","Long", stop = Cut_Profit, when = is_breakthrough == true)

我制定了三种退出策略,如下所述。第一个是要使用的主要退出策略。二是突破后的利润最大化。第三个仅用于切割损耗

1.    strategy.close( "Long",when = Close_Condition == true and is_breakthrough == false)  // main exit strategy
2.    strategy.exit("CP","Long", stop = Cut_Profit, when = is_breakthrough == true)  // maximize profit strategy
3.    strategy.exit("CL","Long", stop = Stop_Price)  // cut loss strategy
但是,在执行整个策略时,**削减损失策略**始终被视为唯一的退出策略。即使满足了策略1或策略2的标准,程序也忽略了这两种策略,并且程序没有采取任何行动(无法出售股票)

如果削减损失策略被删除,策略1和策略2功能正常,并显示预期结果


那么,如何使这三种退出策略发挥作用呢?任何帮助都将不胜感激。谢谢。

发生这种情况是因为您的
CL
总是在市场退出,所以您不能再发送一个订单来关闭同一个位置。您应该怎么做?使用
策略。取消
功能取消previos订单:

// ...some script's logic...
if is_breakthrough
    strategy.cancel("CL") // cancel sent order
    strategy.exit("CP","Long", stop = Cut_Profit) opened a new order on position's close
strategy.exit("CL","Long", stop = Stop_Price)
那么它应该会起作用