以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  交易策略发布专区  (http://weistock.com/bbs/list.asp?boardid=10)
----  [交易系统]顾比倒数线策略  (http://weistock.com/bbs/dispbbs.asp?boardid=10&id=5300)

--  作者:z7c9
--  发布时间:2011/2/25 22:04:33
--  [交易系统]顾比倒数线策略

图片点击可在新窗口打开查看

 

h11:=high;
l11:=low;
a:=ifelse(high>=ref(high,1)&&high>=ref(high,2)&&high>=ref(high,3) &&high>=ref(high,4)&&high>=ref(high,5),low,0);
b:=ifelse(low<=ref(low,1)&&low<=ref(low,2)&&low<=ref(low,3) &&low<=ref(low,4)&&low<=ref(low,5),high,888888);
p1:=ifelse(a>ref(l11,1),ref(l11,1),0);
p2:=ifelse(a>ref(l11,2)&&a<=ref(l11,1),ref(l,2),0);
p3:=ifelse(a>ref(l11,3)&&a<=ref(l11,1)&&a<=ref(l11,2),ref(l11,3),0);
p4:=ifelse(a>ref(l11,4)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3),ref(l11,4),0);
p5:=ifelse(a>ref(l11,5)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4),ref(l11,5),0);
p6:=ifelse(a>ref(l11,6)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4)&&a<=ref(l11,5),ref(l11,6),0);
p7:=ifelse(a>ref(l11,7)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4)&&a<=ref(l11,5)&&a<=ref(l11,6),ref(l11,7),0);
p8:=ifelse(a>ref(l11,8)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4)&&a<=ref(l11,5)&&a<=ref(l11,6)&&a<=ref(l11,7),ref(l11,8),0);
p9:=ifelse(a>ref(l11,9)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4)&&a<=ref(l11,5)&&a<=ref(l11,6)&&a<=ref(l11,7)&&a<=ref(l11,8),ref(l11,9),0);
p10:=ifelse(a>ref(l11,10)&&a<=ref(l11,1)&&a<=ref(l11,2)&&a<=ref(l11,3)&&a<=ref(l11,4)&&a<=ref(l11,5)&&a<=ref(l11,6)&&a<=ref(l11,7)&&a<=ref(l11,8)&&a<=ref(l11,9),ref(l11,10),0);
aa:=p1+p2+p3+p4+p5+p6+p7+p8+p9+p10;
pp1:=ifelse(aa>ref(l11,1),ref(l11,1),0);
pp2:=ifelse(aa>ref(l11,2)&&aa<=ref(l11,1),ref(l11,2),0);
pp3:=ifelse(aa>ref(l11,3)&&aa<=ref(l11,1)&&aa<=ref(l11,2),ref(l11,3),0);
pp4:=ifelse(aa>ref(l11,4)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3),ref(l11,4),0);
pp5:=ifelse(aa>ref(l11,5)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4),ref(l11,5),0);
pp6:=ifelse(aa>ref(l11,6)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4)&&aa<=ref(l11,5),ref(l11,6),0);
pp7:=ifelse(aa>ref(l11,7)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4)&&aa<=ref(l11,5)&&aa<=ref(l11,6),ref(l11,7),0);
pp8:=ifelse(aa>ref(l11,8)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4)&&aa<=ref(l11,5)&&aa<=ref(l11,6)&&aa<=ref(l11,7),ref(l11,8),0);
pp9:=ifelse(aa>ref(l11,9)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4)&&aa<=ref(l11,5)&&aa<=ref(l11,6)&&aa<=ref(l11,7)&&aa<=ref(l11,8),ref(l11,9),0);
pp10:=ifelse(aa>ref(l11,10)&&aa<=ref(l11,1)&&aa<=ref(l11,2)&&aa<=ref(l11,3)&&aa<=ref(l11,4)&&aa<=ref(l11,5)&&aa<=ref(l11,6)&&aa<=ref(l11,7)&&aa<=ref(l11,8)&&aa<=ref(l11,9),ref(l11,10),0);
aaa:=pp1+pp2+pp3+pp4+pp5+pp6+pp7+pp8+pp9+pp10;
c11:=valuewhen(aaa>0,aaa);
t1:=ifelse(b<ref(h11,1),ref(h11,1),0);
t2:=ifelse(b<ref(h11,2)&&b>=ref(h11,1),ref(h11,2),0);
t3:=ifelse(b<ref(h11,3)&&b>=ref(h11,1)&&b>=ref(h11,2),ref(h11,3),0);
t4:=ifelse(b<ref(h11,4)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3),ref(h11,4),0);
t5:=ifelse(b<ref(h11,5)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4),ref(h11,5),0);
t6:=ifelse(b<ref(h11,6)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4)&&b>=ref(h11,5),ref(h11,6),0);
t7:=ifelse(b<ref(h11,7)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4)&&b>=ref(h11,5)&&b>=ref(h11,6),ref(h11,7),0);
t8:=ifelse(b<ref(h11,8)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4)&&b>=ref(h11,5)&&b>=ref(h11,6)&&b>=ref(h11,7),ref(h11,8),0);
t9:=ifelse(b<ref(h11,9)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4)&&b>=ref(h11,5)&&b>=ref(h11,6)&&b>=ref(h11,7)&&b>=ref(h11,8),ref(h11,9),0);
t10:=ifelse(b<ref(h11,10)&&b>=ref(h11,1)&&b>=ref(h11,2)&&b>=ref(h11,3)&&b>=ref(h11,4)&&b>=ref(h11,5)&&b>=ref(h11,6)&&b>=ref(h11,7)&&b>=ref(h11,8)&&b>=ref(h11,9),ref(h11,10),0);
bb:=ifelse((t1+t2+t3+t4+t5+t6+t7+t8+t9+t10)=0,888888,t1+t2+t3+t4+t5+t6+t7+t8+t9+t10);
tt1:=ifelse(bb<ref(h11,1),ref(h11,1),0);
tt2:=ifelse(bb<ref(h11,2)&&bb>=ref(h11,1),ref(h11,2),0);
tt3:=ifelse(bb<ref(h11,3)&&bb>=ref(h11,1)&&bb>=ref(h11,2),ref(h11,3),0);
tt4:=ifelse(bb<ref(h11,4)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3),ref(h11,4),0);
tt5:=ifelse(bb<ref(h11,5)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4),ref(h11,5),0);
tt6:=ifelse(bb<ref(h11,6)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4)&&bb>=ref(h11,5),ref(h11,6),0);
tt7:=ifelse(bb<ref(h11,7)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4)&&bb>=ref(h11,5)&&bb>=ref(h11,6),ref(h11,7),0);
tt8:=ifelse(bb<ref(h11,8)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4)&&bb>=ref(h11,5)&&bb>=ref(h11,6)&&bb>=ref(h11,7),ref(h11,8),0);
tt9:=ifelse(bb<ref(h11,9)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4)&&bb>=ref(h11,5)&&bb>=ref(h11,6)&&bb>=ref(h11,7)&&bb>=ref(h11,8),ref(h11,9),0);
tt10:=ifelse(bb<ref(h11,10)&&bb>=ref(h11,1)&&bb>=ref(h11,2)&&bb>=ref(h11,3)&&bb>=ref(h11,4)&&bb>=ref(h11,5)&&bb>=ref(h11,6)&&bb>=ref(h11,7)&&bb>=ref(h11,8)&&bb>=ref(h11,9),ref(h11,10),0);
bbb:=tt1+tt2+tt3+tt4+tt5+tt6+tt7+tt8+tt9+tt10;
d:=valuewhen(bbb>0,bbb);
ud:=ifelse(close>d&&ref(close,1)<=d,1,ifelse(close<c11&&ref(close,1)>=c11,-3,0));
k:=valuewhen(ud<>0,ud);
g:=ifelse(k=1,c11,d),colorred;
g1:=valuewhen(islastbar,g);
tmp:=-k;
//tmp>0,spk;
//tmp<=0,bpk;

if holding=0 then begin
 if tmp<=0 then
  buy(1,1,limitr,close);
end

if holding=0 then begin
 if tmp>0 then
  buyshort(1,1,limitr,close);  
end

if holding>0 then begin
 if tmp>0 then begin
  sell(1,holding,limitr,close);
  buyshort(1,1,limitr,close);
 end
end

if holding<0 then begin
 if tmp<=0 then begin
  sellshort(1,holding,limitr,close);
  buy(1,1,limitr,close);
 end
end
    
收益:asset,noaxis,colorred;
次数:totaltrade,linethick0;
胜率:percentwin,linethick0;
连亏:maxseqloss,linethick0;
连赢:maxseqwin,linethick0;

[此贴子已经被作者于2011-10-3 11:24:34编辑过]

--  作者:不生气
--  发布时间:2011/12/27 15:19:49
--  
超级高手
--  作者:xxb398
--  发布时间:2011/12/28 4:51:35
--  

不错,谢谢分享。

如能给出逐行解释就更利于大家学习了。


--  作者:wsstsxl
--  发布时间:2012/3/9 10:37:16
--  
太高
--  作者:wangz01
--  发布时间:2012/6/23 22:50:56
--  
okookokokokokok
--  作者:a1121648703
--  发布时间:2013/5/18 13:24:07
--  

什么屁指标,在主图上不显示。骗子

 


--  作者:reboot
--  发布时间:2013/9/21 23:29:02
--  
图片点击可在新窗口打开查看
--  作者:tomato
--  发布时间:2014/4/1 16:39:02
--  
请问顾比倒数线策略是否用到了未来函数