请教:为何回测的交易量跟我预设的不一样?我明明设定25手的,然后回测时好像自动优化了?
回测一开始只交易4手?

此主题相关图片如下:7.png
ss:=25
if NUMPROFIT(1 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1 )>0 then BEGIN
手数:=1;
初始资金10万
不懂发图,见谅
上面代码没看见估计的开平仓语句呀,您贴下完整代码吧
//交易条件
开多条件:= ma(c,a)>ma(c,b);//开多平空条件
开空条件:=ma(c,b)>ma(c,a);//开多平空条件
平多条件:=cross(ma(c,b),ma(c,a));
平空条件:=cross(ma(c,a),ma(c,b));
//交易系统
if NUMPROFIT(1 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 then BEGIN;
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 and NUMPROFIT(3 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1 )>0 then BEGIN
手数:=1;
end
if ma(c,a)>ma(c,b) then BEGIN
开多:BUY(开多条件 and holding=0,手数,MARKET);
end
平多:SELL(平多条件 and HOLDING>0,手数,MARKET);
{IF ENTERPRICE-C>20*MINDIFF THEN BEGIN
多损:SELL(1,0,MARKET),ORDERQUEUE;
END}
if NUMPROFIT(1 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 then BEGIN;
手数:=ss;
end
if NUMPROFIT(1)<0 and NUMPROFIT(2 )<0 and NUMPROFIT(3 )<0 then BEGIN
手数:=ss;
end
if NUMPROFIT(1 )>0 then BEGIN
手数:=1;
end
if ma(c,b)>ma(c,a) then BEGIN
开空:BUYSHORT(开空条件 and HOLDING=0,手数,MARKET);
end
平空:SELLSHORT(平空条件 and HOLDING<0,手数,MARKET);
{IF c-ENTERPRICE>20*MINDIFF THEN BEGIN
空损:SELLshort(1,0,MARKET),ORDERQUEUE;
END}
1、初始手数为1,第一次开仓时
NUMPROFIT(1 )是为0,所以第一次开仓手数就是1手,后续跟进NUMPROFIT(1 )和(2)再调整的;2、把2楼截图位置的初始资金调整大些,10W可能不够开25手,调整到20W试试