用nextopen开仓,开仓日期应为次日,系统显示为当日。
以下是策略代码,用PTA连续测试,测试时间 2006/12/18 -- 2015/05/15,
07.7.11开多,平多。开多执行价格为07.7.12开盘价8408,平多执行价格为07.7.11 man1价8430.
平多价格错误,07.7.11 holding=0,为何能平仓?
开多执行价格为07.7.12开盘价8408,但系统记录07.7.11已经开仓?实际上07.7.11没有开仓。
//参数
Input:n1(20,5,100,8);
Input:n2(2,1,20,2);
Input: 每手合约数(2,1,10000);
//变量准备
MID:ma(c,n1);
Upper:mid+n2*std(c,n1);
lower:mid-n2*std(c,n1);
Man1:=ma(c,n1);
N:=MA(TR,n1);
How:= INTPART( CASH(0)*0.01/n/每手合约数);
//主体语句
If barpos>20 then begin;
//平空
If holding<0 then begin;
PKTJ:=h>man1;
SELLSHORT (PKTJ,0, STOP, man1);
Aa: man1, CIRCLEDOT;
END;
//开多
If holding=0 then begin;
KDTJ:=c>upper;
Buy(KDTJ,how, nextopen);
End;
//平多
If holding>0 then begin;
PDTJ:= l<man1;
SELL(PDTJ,0, STOP, man1);
Bbb:man1,crossdot;
End;
//空开
If holding=0 then begin;
KKTJ:=c<lower;
BUYSHORT(KKTJ,how, nextopen);
END;
END;
截图看下你的测试设置,并上传你的测试报告