variable:n=0,m=0;
mm:=ref(h,1)=hhv(h,3);
nn:=ref(l,1)=llv(l,3);
if mm then bj:=1;
if nn then bj:=-1;
nn1:=barslast(mm);
nn2:=barslast(nn);
if c<ref(l,nn1+1) and bj=1 then i:=1;
if c>ref(h,nn2+1) and bj=-1 then i:=-1;
uu3:=cross(i=1,0.5);
uu4:=cross(i=-1,0.5);
if uu3 or ((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1))) or (ref(h,1)=hhv(h,3) and c<ref(l,1)) then begin
n:=0;
m:=m+1;
end
//m为绿色
if uu4 or (ref(l,1)=llv(l,3) and c>ref(h,1)) or ((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1))) then begin
n:=n+1;
m:=0;
end
//n为红色
STICKLINE(cross(m,0.5),h,l,7.5,0),COLORgreen;
STICKLINE(cross(n,0.5),h,l,7.5,0),COLORred;
因为你不讲你的代码要实现什么功能,所以就按照你的要求改柱子的形成,也没看代码是什么意思。
根据你上面讲的定义,发现你这一段代码不知道要做什么,又是I又是BJ的,所以做了一个修改
variable:n=0,m=0;
mm:=ref(h,1)=hhv(h,3);
nn:=ref(l,1)=llv(l,3);
variable:bj=0;
nn1:=barslast(mm);
nn2:=barslast(nn);
if c<ref(l,nn1+1) then bj:=1;
if c>ref(h,nn2+1) then bj:=-1;
uu3:=cross(bj=1,0.5);
uu4:=cross(bj=-1,0.5);
if uu3 or ((ref(c,1)>ref(o,1) and h>ref(h,1) and c<ref(l,1))) or (ref(h,1)=hhv(h,3) and c<ref(l,1)) then begin
n:=0;
m:=m+1;
end
//m为绿色
if uu4 or (ref(l,1)=llv(l,3) and c>ref(h,1)) or ((ref(o,1)>ref(c,1) and l<ref(l,1) and c>ref(h,1))) then begin
n:=n+1;
m:=0;
end
//n为红色
STICKLINE(cross(m,0.5),h,l,7.5,0),COLORgreen;
STICKLINE(cross(n,0.5),h,l,7.5,0),COLORred;