等级: 免费版
- 注册:
- 2022-4-2
- 曾用名:
|
老师您好,不知道为啥,程序连续出现了卖出信号,明明没有持仓;以下是源码,哪里出了问题呀
//定义开平仓条件
condbuy1:=bm&&b1;
condbuy2:=bm&&b2;
condsel1:=sm&&s1;
condsel2:=sm&&s2;
sp1:=bd&&s1&&holding>0;
sp2:=bd&&s2&&holding>0;
sp3:=bd&&bm&&holding>0;
szs1:=sd&&holding>0;
bp1:=sd&&b1&&holding<0;
bp2:=sd&&b2&&holding<0;
bp3:=sd&&sm&&holding<0;
bzs1:=bd&&holding<0;
//交易系统
开买1:BUY(condbuy1,2%,THISCLOSE),pertrader; //开仓1
开买2:BUY(condbuy2,2%,THISCLOSE),pertrader; //开仓2
卖抛1:SELL(sP1,2%,THISCLOSE),pertrader; //平仓1
卖抛2:SELL(sP2,2%,THISCLOSE),pertrader; //平仓2
卖抛3:SELL(sP3,2%,THISCLOSE),pertrader; //平仓3
卖抛4:SELL(szs1,2%,THISCLOSE),pertrader; //平仓4
开卖1:BUYshort(condsel1,2%,THISCLOSE),pertrader; //开仓1
开卖:BUYshort(condsel2,2%,THISCLOSE),pertrader; //开仓2
买抛1:SELLshort(bP1,2%,THISCLOSE),pertrader; //平仓1
买抛2:SELLshort(bP2,2%,THISCLOSE),pertrader; //平仓2
买抛3:SELLshort(bP3,2%,THISCLOSE),pertrader; //平仓3
买抛4:SELLshort(bzs1,2%,THISCLOSE),pertrader; //平仓4
|
|