南客 2004-7-21 17:42
股票箱公式
应狐友要求制作了股票箱公式,使用了较多的控制语句,把公式发上来,供大家参考:
[code]
fh:=high;
fl:=low;
sell:=0*fh;
buy:=sell;
signal:=sell;
boxh:sell,linethick0;
boxl:sell,linethick0;
variable:hc=0,lc=0,bt=fh[1],bb=fh[1];
for i=1 to datacount do begin
if hc>1 then begin
if lc>2 and bt<=fh[i] then begin
buy[i]:=1;
for j=i-1 downto i-hc do begin
boxh[j]:=fh[i-hc];
boxl[j]:=fl[i-lc];
end;
hc:=0;lc:=0;
end;
if bt>fh[i] then begin
if lc>2 then begin
if bb>=fl[i] then begin
sell[i]:=1;
for j=i-1 downto i-hc do begin
boxh[j]:=fh[i-hc];
boxl[j]:=fl[i-lc];
end;
hc:=-1;lc:=0;
end else begin
boxh[i]:=fh[i-hc];
boxl[i]:=fl[i-lc];
end;
end;
hc:=hc+1;
if lc>1 then begin
if bb<fl[i] then begin
lc:=lc+1;
if lc=3 then begin
signal[i-hc+1]:=1;
for j=i downto i-hc+1 do begin
boxh[j]:=fh[i-hc+1];
boxl[j]:=fl[i-lc+1];
end;
end;
end else lc:=0;
end else
if lc=1 then begin
if bb<fl[i] then begin
lc:=lc+1;
end else lc:=0;
end;
if lc=0 and hc>1 then begin
bb:=fl[i];
lc:=lc+1;
end;
end else begin hc:=0; lc:=0; end;
end else
if hc=1 then begin
if bt>fh[i] then
hc:=hc+1
else begin hc:=0;lc:=0; end;
end;
if hc=0 then begin
bt:=fh[i];
hc:=hc+1;
end;
end;
partline(boxh and boxh=ref(boxh,1),boxh),coloryellow,pointdot;
partline(boxl and boxl=ref(boxl,1),boxl),coloryellow,pointdot;
stickline((signal||refx(buy||sell,1))&&boxh,boxh,boxl,0.1,0),pointdot,coloryellow;
drawicon(buy,low*0.98,4);
drawicon(sell,high*1.02,5);
[/code]
南客 2004-7-21 18:17
哦,你的飞狐版本偏低,不支持linedot
删除这个线型描述符就行了,不过画出的股票箱就不是虚线,而是实线,难看些
txyx58369 2004-7-21 20:37
[quote][i]股道[/i] 于 2004-7-21 06:00 PM 写道:
partline(boxh and boxh=ref(boxh,1),boxh),coloryellow,linedot;
谢谢,这句说语句缺少分号! [/quote]
我的也这样,我用的是《战无不胜》,没有新版。
大香山 2004-7-21 21:16
very good
:cool::cool::cool::cool::cool:
:clap::clap::clap::clap:
1lxj2wh 2004-7-22 07:24
下载了,谢谢! :clap::clap::clap:
fujiu 2004-7-22 09:16
下载了,谢谢! :
clap::clap::clap:
cwy 2004-7-22 13:21
答谢南客朋友,发一个长短股票箱公式
网上多次请教南客朋友,顺祝南客朋友均安,为感谢南客朋友,也发一个长短股票箱公式,我是以收盘价计算的,如要以高低价计算,可自行修改。
HDTS:=HHVBARS(c,0)+1;
LDTS:=LLVBARS(c,0)+1;
HD:HHV(c,LDTS);
LD:LLV(c,HDTS);
HDTS1:=HHVBARS(hd,LDTS)+1;
LDTS1:=LLVBARS(ld,HDTS)+1;
HD1:HHV(c,LDTS1);
LD1:LLV(c,HDTS1);
[color=Teal][align=right] 本贴由 cwy 于 2004-7-22 13:38 最后编辑 [/align][/color]
白郎 2004-7-31 08:00
多谢南客老师。不过提一点请求,能不能写源码的时候,在必要的地方注明一下语句说明,给喜欢看源码的朋友减轻点负担。 多谢了。
asdfghjkl 2004-8-19 20:15
dddddddddddddddddddddddddddd
139743369 2004-8-20 01:03
okk
peter1815 2004-8-21 23:03
3q
yyxxtt1234 2004-8-23 09:11
下载了,谢谢
zhaozhaosjz 2004-8-23 11:25
谢了谢了
lhl311 2004-8-30 06:28
答"怎么我的在副图里出现而不是在主图里出现啊"
在编缉器由上至下的第行的"主图叠加"打勾