我的套利策略,2个图层怎么发单不一致,求助老师
我写的这个套利策略,其他地方都还好,就是这个减仓部分出了问题,百思不得其解,想向各位老师请教 Events OnInit() { layers[0]=SubscribeBar(“pp888.DCE”, "30m", 20211101.0930); layers[1]=SubscribeBar(“MA888.CZCE”, "30m", 20211101.0930); } OnBar(ArrayRef<Integer> indexs) { //买多部分 //开仓1 If(k1==0 and jiacha<bz-db1) {data0.buy(lots1,data0.open); data1.SellShort(lots1,data1.open);Commentary("开仓1"); lotsj=lots1;k1=1;Return; } //加仓2 If(k1==1 and jiacha<bz-2*db1) {data0.buy(2*lots1,data0.open); data1.SellShort(2*lots1,data1.open);Commentary("加仓2"); lotsj=lots1*2;k1=2;Return; } //加仓3 If(k1==2 and jiacha<bz-3*db1) {data0.buy(3*lots1,data0.open); data1.SellShort(3*lots1,data1.open);Commentary("加仓3"); lotsj=lots1*3;k1=3;Return; } //分批减仓 If(k1>0 and jiacha>lowestjc) { data0.Sell(lotsj,data0.open); data1.BuyToCover(lotsj,data1.open); Commentary(" 减仓"); k1=k1-1;lotsj=lotsj-1;Return; } } 问题如下图 把图放大