A1:=HIGH;
B1:=LOW;
C1:=CLOSE;
A2:=REF(HIGH,2);
A5:=REF(HIGH,5);
A6:=REF(HIGH,6);
B2:=REF(LOW,2);
B5:=REF(LOW,5);
B6:=REF(LOW,6);
C7:=REF(CLOSE,7);
C8:=REF(CLOSE,8);
NUM1:=IF(A2<C7 AND A2<C8 AND A1<B5 AND A1<B6,0,1);
NUM2:=IF(B2>C7 AND B2>C8 AND B1>A5 AND B1>A6,0,1);
DIF1:=A1-A2;
DIF2:=B1-B2;
REII:=(DIF1+DIF2)*NUM1*NUM2;
REIA:=SQRT(DIF1*DIF1)+SQRT(DIF2*DIF2);
REI:SUM(REII,8)/SUM(REIA,8),COLORWHITE,LINETHICK2;