我写了段代码画不出来,请哪位帮忙修改指导,谢谢! Code: input:per(10,3,30,1); variable:dir=0,pe=0,pepos=0,tr=0,trpos=0; if dir=0 then begin if high/llv(low,0)>=(1+per/100) then begin pe:=high; pepos:=barpos; dir:=1; end else if low/hhv(high,0)<=(1-per/100) then begin tr:=low; trpos:=barpos; dir:=-1; end end if dir=1 then begin if high>pe then begin pe:=high; pepos:=barpos; end else if low/pe<=(1-per/100) then begin zz1:drawline(barpos=trpos,low,barpos=pepos,high,2); tr:=low; trpos:=barpos; dir:=-1; end end if dir=-1 then begin if low<tr then begin tr:=low; trpos:=barpos; end else if high/tr<(1+per/100) then begin zz2:drawline(barpos=pepos,high,barpos=trpos,low,2); pe:=high; pepos:=barpos; dir:=1; end end;
inputer(10,3,30,1); variable:dir=0,pe=0,pepos=0,tr=0,trpos=0; if dir=0 then begin if high/llv(low,0)>=(1+per/100) then begin pe:=high; pepos:=barpos; dir:=1; end else if low/hhv(high,0)<=(1-per/100) then begin tr:=low; trpos:=barpos; dir:=-1; end end if dir=1 then begin if high>pe then begin pe:=high; pepos:=barpos; hy1:1; end else if low/pe<=(1-per/100) then begin zz1:drawline(barpos=trpos,low,barpos=pepos,high,2); tr:=low; trpos:=barpos; dir:=-1; end end if dir=-1 then begin if low<tr then begin tr:=low; trpos:=barpos; hy2:2; end else if high/tr<(1+per/100) then begin zz2:drawline(barpos=pepos,high,barpos=trpos,low,2); pe:=high; pepos:=barpos; dir:=1; end end;
程序转入 if high>pe then begin pe:=high; pepos:=barpos; end if low<tr then begin tr:=low; trpos:=barpos; end 试加了hy1:1; hy2:2;就可以测试出了。
分析家公式是纯标量的,隐含了一个对k线bar的循环,因此在语句中只能对当前bar根据条件操作,而不能再回头对历史的bar进行操作,因此drawline实际是在当前bar上画一个带起点或终点属性的点,系统最后再根据各点的属性用线连接起来,而不能直接画一条跨多个bar的直线.因此在逻辑上不用未来数据是不可能实现的,因为当波峰(谷)得到确认的时候在隐含循环中已经过了波峰(谷)所在的bar了,因而来不及在图形上将波峰(谷)标出来了.