runmode:0;
movavg:=wma((high+low+close)/3,20);
truerange:=max(ref(close,1),high)-min(ref(close,1),low);
upband:=movavg+ma(truerange,20);
dnband:=movavg-ma(truerange,20);
if cross(c,upband) then buy(holding=0,1,limitr,upband);
if cross(dnband,c) then buyshort(holding=0,1,limitr,dnband);
if cross(close,movavg) then sell(holding>0,holding,limitr,c);
if cross(movavg,close) then sellshort(holding<0,holding,limitr,c);
请看问题在哪里, 我加了 enterbars>=1 仍然无效
if cross(close,movavg) then sell(holding>0 and enterbars>=1,holding,limitr,c);
if cross(movavg,close) then sellshort(holding<0 and enterbars>=1,holding,limitr,c);
委托价格的原因,upband这样的委托价是最小变动价位的整数倍吗?能成交吗?
if cross(c,upband) then buy(holding=0,1,limitr,c);//类似位置,不妨都改成C或者C+/-(n*MINFIFF);
关键在于取最小变动价位的整数倍,以下示例,如果有不中意的地方,可以自行修改.
以IF为例,如果使3152.5数值转化为0.2的整数倍
INTPART(3152.5/mindiff)*mindiff
应该是跟开平仓条件没关系.
把您的委托TYPE变为LIMIT--委托价格变为CLOSE.图上显示就是没问题的.
您本地多尝试一下吧.