查看完整版本: 股票箱公式

南客 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 17:44

图示:

南客 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:

maxyan 2004-7-22 12:48

谢谢!!

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]

yngs 2004-7-22 13:48

谢谢!

dlhwj 2004-7-22 17:22

谢谢了。

小狐 2004-7-23 12:34

不错

szluka 2004-7-30 16:39

多谢!

wxs 2004-7-30 17:49

多谢!

无无 2004-7-31 07:01

非常感谢

白郎 2004-7-31 08:00

多谢南客老师。不过提一点请求,能不能写源码的时候,在必要的地方注明一下语句说明,给喜欢看源码的朋友减轻点负担。  多谢了。

lwh315 2004-8-2 17:31

谢谢!

lhl311 2004-8-17 09:30

多谢南客老师。

xiwang 2004-8-17 10:38

谢谢

枪手 2004-8-17 11:57

谢谢南客.

王庆 2004-8-17 15:26

谢谢

大炼钢铁 2004-8-19 04:11

感谢

海獭 2004-8-19 13:17

ok

学学好。

asdfghjkl 2004-8-19 20:15

dddddddddddddddddddddddddddd

139743369 2004-8-20 01:03

okk

绿色通道 2004-8-21 04:52

多谢!

liuxp 2004-8-21 08:41

谢谢你的热心。

wy589 2004-8-21 12:11

ok

lutaoxin 2004-8-21 14:51

下载了,谢谢!

peter1815 2004-8-21 23:03

3q

朦朦胧胧 2004-8-22 22:56

谢谢南客老师

ufljting 2004-8-22 23:01

謝謝

chenlinm 2004-8-23 09:08

谢谢!!!

yyxxtt1234 2004-8-23 09:11

下载了,谢谢

zhaozhaosjz 2004-8-23 11:25

谢了谢了

coolkiss 2004-8-25 13:56

怎么我的在副图里出现而不是在主图里出现啊,

shixx 2004-8-25 14:44

非常感谢

一路上扬 2004-8-25 22:46

谢谢南客老师

lhl311 2004-8-30 06:28

答"怎么我的在副图里出现而不是在主图里出现啊"
在编缉器由上至下的第行的"主图叠加"打勾

lb9948 2004-8-30 08:47

谢谢南客老师 !
页: [1] 2 3
查看完整版本: 股票箱公式