以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  金字塔软件问题提交  (http://weistock.com/bbs/list.asp?boardid=2)
----  编写模型后运行显示不对  (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=71313)

--  作者:oO_kylin_Oo
--  发布时间:2014/10/23 16:55:23
--  编写模型后运行显示不对
我编写了一段代码:

TR1 := MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR := MA(TR1,m);

h14:ref(hhv(h,14),1);
l14:ref(llv(l,14),1);

开多h1:buy( cross(h,h14) and holding=0 ,ss,limitr,max(h14,o)+3*MINDIFF);
开空l1:buyshort( cross(l14,l) and holding=0   ,ss,limitr,min(l14,o)-3*mindiff);
开多h3:buy(  cross(h,h14) and holding=0  ,ss,limitr,max(h14,o)+3*mindiff);
开空l3:buyshort((  cross(l14,l)) and holding=0   ,ss,limitr,min(l14,o)-3*mindiff);

多止盈:sell(h-(ENTERPRICE-mindiff)>2*ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+2*ref(atr,1)-mindiff,o));
空止盈:sellshort((enterprice-mindiff)-l>2*ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice-mindiff-2*ref(atr,1),o));
多止损:sell((enterprice+mindiff)-l>ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+mindiff-ref(atr,1),o));
空止损:sellshort(h-(ENTERPRICE+mindiff)>ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice+ref(atr,1)+mindiff,o));
利润:NETPROFIT,NOAXIS,LINETHICK2,colorred;
最大回撤:maxdrawdown,noaxis;
平均亏损:avgloss,noaxis;


运行后却出现这样的:

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20141023164944.jpg
图片点击可在新窗口打开查看
放大后是这样的:

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20141023165023.jpg
图片点击可在新窗口打开查看
在那个开多之后就再也没交易了,所以netprofit也没有动了,但是最大回撤却还在变
很奇怪怎么会出现这样的情况,我代码通过了编译啊,怎么会出现这样奇怪的图像


--  作者:FexTel
--  发布时间:2014/10/23 17:14:55
--  

1,看下你SELL语句把,是不是对应的条件根本就满足不了,才会一直只有多单

把相应条件变量在图上输出看下值的变化情况


--  作者:oO_kylin_Oo
--  发布时间:2014/10/23 17:28:45
--  
不行 ,我加了个:多止盈1:h-(ENTERPRICE-mindiff)-2*ref(atr,1),noaxis;
                       多止损1:(enterprice+mindiff)-l-ref(atr,1),noaxis;
把平多的条件输出了看,是正常的而且也能达到条件。按道理应该在那个最后的多单的后的第六根k线止盈的。
回复怎么发图片。。。

--  作者:FexTel
--  发布时间:2014/10/23 17:32:18
--  
把参数都给出来把,让工作人员调试下。您这个后面SELL条件里面绝对是有个条件一直不满足的,您自己也可以把条件拆分来看
--  作者:oO_kylin_Oo
--  发布时间:2014/10/23 17:35:48
--  
就只有m一个参数,就是算atr的那个的而已;



input:m(20,1,100,1);

TR1 := MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR := MA(TR1,m);


h14:ref(hhv(h,14),1);
l14:ref(llv(l,14),1);








开多h1:buy( cross(h,h14) and holding=0 ,ss,limitr,max(h14,o)+3*MINDIFF);
开空l1:buyshort( cross(l14,l) and holding=0   ,ss,limitr,min(l14,o)-3*mindiff);

开多h3:buy(  cross(h,h14) and holding=0  ,ss,limitr,max(h14,o)+3*mindiff);
开空l3:buyshort((  cross(l14,l)) and holding=0   ,ss,limitr,min(l14,o)-3*mindiff);
多止盈1:h-(ENTERPRICE-mindiff)-2*ref(atr,1),noaxis;
多止损1:(enterprice+mindiff)-l-ref(atr,1),noaxis;
多止盈:sell(h-(ENTERPRICE-mindiff)>2*ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+2*ref(atr,1)-mindiff,o));
空止盈:sellshort((enterprice-mindiff)-l>2*ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice-mindiff-2*ref(atr,1),o));
多止损:sell((enterprice+mindiff)-l>ref(atr,1) and type(1)=2 and enterbars>0,0,limitr,min(enterprice+mindiff-ref(atr,1),o));
空止损:sellshort(h-(ENTERPRICE+mindiff)>ref(atr,1) and type(1)=3 and enterbars>0,0,limitr,max(enterprice+ref(atr,1)+mindiff,o));
利润:NETPROFIT,NOAXIS,LINETHICK2,colorred;
最大回撤:maxdrawdown,noaxis;
平均亏损:avgloss,noaxis;

--  作者:oO_kylin_Oo
--  发布时间:2014/10/23 23:19:03
--  
我找出问题来了 不用麻烦了 谢谢!