Pine script 如何在一个脚本中创建多个单独的长入单和长出单

Pine script 如何在一个脚本中创建多个单独的长入单和长出单,pine-script,algorithmic-trading,trading,back-testing,Pine Script,Algorithmic Trading,Trading,Back Testing,我正在试图找出如何在一个脚本中创建多个长订单。 例如,我编写了一个脚本,其中包含3个买入/卖出条件,我希望每个脚本都有自己的进入/退出参数。弄清楚如何在一个脚本中排序多个长条目是我目前的障碍 目前有“主要”、“快速”和“批量”战略 不管我怎么做,每一个都是独立运行的,但当一起运行时,无论哪一个运行得最快,基本上都会运行。也许100倍于较低的一个交易中有一个会滑出,然后有时不同的策略会在该交易中卖出/做多,而不是让买入该策略的策略决定何时卖出 我尝试过的方法包括嵌套循环和strategy.oca组

我正在试图找出如何在一个脚本中创建多个长订单。
例如,我编写了一个脚本,其中包含3个买入/卖出条件,我希望每个脚本都有自己的进入/退出参数。弄清楚如何在一个脚本中排序多个长条目是我目前的障碍

目前有“主要”、“快速”和“批量”战略

不管我怎么做,每一个都是独立运行的,但当一起运行时,无论哪一个运行得最快,基本上都会运行。也许100倍于较低的一个交易中有一个会滑出,然后有时不同的策略会在该交易中卖出/做多,而不是让买入该策略的策略决定何时卖出

我尝试过的方法包括嵌套循环和strategy.oca组。我一直在查看文档,但没有一个文档演示我的场景——我发现的场景是多个条目和一个大出口。我希望每个战略都能自己进出。我三点开始练习金字塔。我尝试过使用Strategy.position_size==0条目,并尝试添加一个变量来阻止条件排序,如果它已经有一个顺序,但我尝试过的都不起作用。
如果重要的话,我不会使用任何保证金

if OrderLong and not OrderShort
    strategy.cancel(id="Sell")
    strategy.entry(id="Buy", long=true, comment="Buy")  //strategy.entry(id="Buy", long=true, stop=high, comment="Buy", limit=(OrderLimit))

if OrderShort and not OrderLong and not OrderShortFast
    strategy.cancel(id="Buy")
    strategy.exit("Sell", "Buy", stop=low, limit=(OrderLimit),comment="Sell")
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////    
if OrderLongFast and not OrderShortFast
    strategy.cancel(id="SellFast")
    strategy.entry(id="BuyFast", long=true, comment="Buy Fast")           //strategy.entry("BuyFast", long=true, stop=high, comment="Buy Fast", limit=(OrderLimit))

         
if OrderShortFast and not OrderShort
    strategy.cancel(id="BuyFast")
    strategy.exit("SellFast", "BuyFast", stop=low, limit=(OrderLimit),comment="Sell Fast")    
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     
if OrderLongVol
    strategy.cancel(id="SellVol")
    strategy.entry(id="BuyVol", long=true, comment="Buy Vol")           //strategy.entry("BuyFast", long=true, stop=high, comment="Buy Fast", limit=(OrderLimit))
if OrderShortVol
    strategy.cancel(id="BuyVol")
    strategy.exit("SellVol", "BuyVol", stop=low, limit=(OrderLimit),comment="Sell Vol")    

在调用
策略()
时,是否使用
close\u entries\u rule=“ANY”
参数


嘿,对不起,我没有回复您,这是正确的解决方案,您的回复帮助我向前迈进!默认策略()是不允许我的特定指令打开多个位置,这是不直观的。