buy和sellshort只执行一部分的问题

buy和sellshort的问题,以buy为例,在空头时,有的品种执行buy后,只有买入开仓的操作,没有买入平仓的操作

 

 

Params
    Numeric Length1(50);                                //长周期区间参数
    Numeric Length2(30);                                //短周期区间参数
    Numeric IPS(4);                                        //保护止损波动率参数
    Numeric AtrVal(10);                                    //波动率参数
    Numeric initcapital(50);                            //单位:万    国债期货可以改成50
    Numeric  Acceleration(0.05);                       //抛物线的加速系数
    Numeric  FirstBarMultp(5);                           //用于计算在进场Bar设置止损价的系数
    
Vars
    natural Series<Numeric> myprice;                            //临界价格
    natural Series<Numeric> myprice_temp;                       //临时的临界价格
    natural Series<Numeric> myprice_new;                        //记录因为止损而产生的新的临界价格
    natural Series<Numeric> nn;                                 //向前计算的日期
   
    Numeric temp10;                      //控制onbarclose的开仓次数
    Array<Numeric> timepoint([0.145850]);
    
    
    natural Series<Numeric> cros; 
    natural Numeric clo_temp;                           //收盘平仓价
    natural Series<Numeric> i;                                  //循环参数
    //Numeric lots(1);        //下单手数
    natural Numeric lots;  

 

 OnBarClose(ArrayRef<Integer> indexs)
    {
      //Lots=IntPart(Portfolio_CurrentCapital*1/(open*contractunit*BigPointValue));
      range[1:1]
      {
          If(time==0.1458)
             {
                 clo_temp=close;
                 temp10=0;
             }
      If(data0.Marketposition ==1 and clo_temp<data0.cros and time==0.1458 and temp10==0)
            {
               //Sell(data0.lots, Open);
               SellShort(data0.lots, Open);
               temp10=1;
               }
      
       If(data0.Marketposition ==-1 and clo_temp>data0.cros and time==0.1458 and temp10==0)
           {
               //BuyToCover(data0.lots, Open);
               buy(data0.lots, Open);
               temp10=1;
               }

sellshort和buy被触发,但图表上只出现了sell或buytocover信号
buy和sellshort
A_sendorder和Buy,SellShort区别
buy sellshort.... 成交机制问题
能否实盘中策略的sellshort和buy指令只操作A账户不操作B账户,B账户仅用A函数操作?
请教个buy,SellShort函数问题
有时候sell 和sellshort ,buy和buytocover会功能混乱
请问这个代码为什么Buy和SellShort会失败
当前的K线只执行一次
使用A_SellShort和A_BuyToCover后开平互转问题