tr1 :=max(max((high-low),abs(ref(close,1)-high)),abs(ref(close,1)-low));
atr:=ma(tr1,length);
enterbars1:=enterbars+1;
dstop1:=dstop-4*ref(atr,1);//平多价
kstop1:=kstop+4*ref(atr,1);//平空价
dstop:=hhv(h,enterbars1);//实时进多平仓价
kstop:=llv(l,enterbars1);//实时进空平仓价
zsx1:=if(dstop>enterprice+20*ref(atr,enterbars1),enterprice+5*mindiff,0.02*ref(c,enterbars1));
zsx2:=if(kstop<enterprice-20*ref(atr,enterbars1),enterprice-5*mindiff,0.02*ref(c,enterbars1));
if myhoiding>0 and c<=max(zsx1,dstop1) then sell(1,0,marketr);
if myhoiding<0 and c>=min(zsx2,kstop1) then sellshort(1,0,marketr);
上面止损不知什么原因?修改“20*ref(atr,enterbars1)”为200*ref(atr,enterbars1)”结果一样!!
你输出一下dstop和ref(atr,enterbars1)
看看是不是dstop很大,大到比200*ref(atr,enterbars1)还大