VA1:=TROUGHBARS(2,15,1);
VR1:=PEAKBARS(1,15,1);
VA2:=IF(VA1=0,1,0);
VR2:=IF(VR1=0,1,0);
AA:DRAWLINE(BARSLAST(VA1),L,VA2,L,1);
BB:DRAWLINE(BARSLAST(VR1),H,VR2,H,1);
A6a:=REF(HIGH,6)=HHV(HIGH,2*6+1);
B6a:=FILTER(A6a,6);
C6a:=BACKSET(B6a,6+1);
D6a:=FILTER(C6a,6);
A7a:=REF(LOW,6)=LLV(LOW,2*6+1);
B7a:=FILTER(A7a,6);
C7a:=BACKSET(B7a,6+1);
D7a:=FILTER(C7a,6);
E6a:=(REF(LLV(LOW,2*6),1)+REF(HHV(HIGH,2*6),1))/2;
E7a:=(HIGH+LOW)/2;
H6a:=(D6a AND NOT(D7a AND E6a>=E7a)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H7a:=D6a AND NOT(D7a AND E6a>=E7a);
L6a:=D7a AND NOT(D6a AND E6a=E7a);
X6a:=REF(BARSLAST(H6a),1)+1;
F6a:=BACKSET(H6a AND COUNT(L6a,X6a)>0,LLVBARS(IF(L6a,LOW,10000),X6a));
G6a:=F6a>REF(F6a,1);
I6a:=BACKSET(G6a,2);
LD2a:=I6a>REF(I6a,1);
L7a:=LD2a OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X7a:=REF(BARSLAST(L7a),1)+1;
F7a:=BACKSET(L7a AND COUNT(H7a,X7a)>0,HHVBARS(IF(H7a,HIGH,0),X7a));
G7a:=F7a>REF(F7a,1);
I7a:=BACKSET(G7a,2);
HD2a:=I7a>REF(I7a,1);
UU3a:=BACKSET(BARSTATUS=2,BARSLAST(LD2a)+1);
VV3a:=UU3a>REF(UU3a,1);
WW3a:=BACKSET(VV3a,REF(BARSLAST(LD2a),1)+2);
XX3a:=WW3a>REF(WW3a,1);
DRAWLINE(XX3a,L,VV3a,L,1),Color80f040;
UU4a:=BACKSET(BARSTATUS=2,BARSLAST(HD2a)+1);
VV4a:=UU4a>REF(UU4a,1);
WW4a:=BACKSET(VV4a,REF(BARSLAST(HD2a),1)+2);
XX4a:=WW4a>REF(WW4a,1);
DRAWLINE(XX4a,H,VV4a,H,1),Color8000f0;