以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  止损20点和止损200点效果一样,为何?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=143439)

--  作者:tanyongde
--  发布时间:2016/11/25 16:48:40
--  止损20点和止损200点效果一样,为何?
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)”结果一样!!

--  作者:jinzhe
--  发布时间:2016/11/25 17:00:08
--  

你输出一下dstop和ref(atr,enterbars1)

看看是不是dstop很大,大到比200*ref(atr,enterbars1)还大