input:m(75,5,200,5),k(1,0.5,10,0.5)ss(1,1,1000,1);
MID: MA(CLOSE,M);//布林中轨
top: MID + K*STD(CLOSE,M);//布林上轨
bottom: MID - K*STD(CLOSE,M);//布林下轨
//交易条件
conbpk:=CROSS(C,bottom);//没有加入holding<=0是因为考虑到一开始应该是无仓位,不知这样想对不对;
conspk:=CROSS(top,C);
sellshort(conbpk,0,thisclose),orderqueue,ignorecheckprice;
buy(conbpk,ss,thisclose),orderqueue,ignorecheckprice;
sell(conspk,0,thisclose),orderqueue,ignorecheckprice;
buyshort(conspk,ss,thisclose),orderqueue,ignorecheckprice;
当前持仓:HOLDING,COLORGRAY,LINETHICK0;
当前资产:ASSET,NOAXIS,COLORGRAY;
sellshort(conbpk,0,thisclose),orderqueue,ignorecheckprice;
buy(conbpk and holding=0,ss,thisclose),orderqueue,ignorecheckprice;
sell(conspk,0,thisclose),orderqueue,ignorecheckprice;
buyshort(conspk and holding=0,ss,thisclose),orderqueue,ignorecheckprice;
开仓语句里面最好加个holding=0的判断。其他基本OK 了。
我刚才再仔细看了用法,觉得两个平仓命令其实不要orderqueue刚好,是不是?
这个指令一开始设计是为了能成功平仓之后再开仓,防止无法回笼资金开仓失败。建议你还是成对写吧。