a formula called renko binary wave
K:=1.896;
RenkoLine:=If(Cum(1)=1,CLOSE,
If(PREV>=0,
If(CLOSE<PREV-2*K,-(PREV-2*K),
Floor(Max(C-PREV,0)/K)*K+PREV),
If(CLOSE>Abs(PREV)+2*K,-PREV+2*K,
Floor(Max(Abs(PREV)-C,0)/K)*K+PREV)));
RL:=Abs(RenkoLine);
RL;
BW:=If(Cum(1)=1,0,
If(RL>Ref(RL,-1),+1,If(RL<Ref(RL,-1),-1,PREV)));
BW;0;