N:=350;
Y1:=C>O OR (C=O AND C>=REF(C,1));
Y2:=C
L2:=IF(Y2,VOL,9999999999);
T1:=CONST(FINDHIGHBARS(L1,0,N,1));
T2:=CONST(FINDHIGHBARS(L1,0,N,2));
T3:=CONST(FINDHIGHBARS(L1,0,N,3));
T4:=CONST(FINDHIGHBARS(L1,0,N,4));
T5:=CONST(FINDHIGHBARS(L1,0,N,5));
T6:=CONST(FINDHIGHBARS(L1,0,N,6));
T7:=CONST(FINDHIGHBARS(L1,0,N,7));
T8:=CONST(FINDHIGHBARS(L1,0,N,8));
T9:=CONST(FINDHIGHBARS(L1,0,N,9));
T10:=CONST(FINDHIGHBARS(L1,0,N,10));
D1:=CONST(FINDLOWBARS(L2,0,N,1));
D2:=CONST(FINDLOWBARS(L2,0,N,2));
D3:=CONST(FINDLOWBARS(L2,0,N,3));
D4:=CONST(FINDLOWBARS(L2,0,N,4));
D5:=CONST(FINDLOWBARS(L2,0,N,5));
D6:=CONST(FINDLOWBARS(L2,0,N,6));
D7:=CONST(FINDLOWBARS(L2,0,N,7));
D8:=CONST(FINDLOWBARS(L2,0,N,8));
D9:=CONST(FINDLOWBARS(L2,0,N,9));
D10:=CONST(FINDLOWBARS(L2,0,N,10));
DRAWLINE(CURRBARSCOUNT=T1+1,C,ISLASTBAR,REF(C,T1),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T2+1,C,ISLASTBAR,REF(C,T2),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T3+1,C,ISLASTBAR,REF(C,T3),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T4+1 ,C,ISLASTBAR,REF(C,T4),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T5+1 ,C,ISLASTBAR,REF(C,T5),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T6+1 ,C,ISLASTBAR,REF(C,T6),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T7+1 ,C,ISLASTBAR,REF(C,T7),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T8+1 ,C,ISLASTBAR,REF(C,T8),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T9+1 ,C,ISLASTBAR,REF(C,T9),0),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=T10+1 ,C,ISLASTBAR,REF(C,T10),0),COLORMAGENTA;
E:DRAWLINE(CURRBARSCOUNT=D1+1 ,C,ISLASTBAR,REF(C,D1),0),COLORGREEN;
E1:DRAWLINE(CURRBARSCOUNT=D2+1,C,ISLASTBAR,REF(C,D2),0),COLORGREEN;
E2:DRAWLINE(CURRBARSCOUNT=D3+1,C,ISLASTBAR,REF(C,D3),0),COLORGREEN;
E3:DRAWLINE(CURRBARSCOUNT=D4+1 ,C,ISLASTBAR,REF(C,D4),0),COLORGREEN;
E4:DRAWLINE(CURRBARSCOUNT=D5+1,C,ISLASTBAR,REF(C,D5),0),COLORGREEN;
E5:DRAWLINE(CURRBARSCOUNT=D6+1 ,C,ISLASTBAR,REF(C,D6),0),COLORGREEN;
E6:DRAWLINE(CURRBARSCOUNT=D7+1,C,ISLASTBAR,REF(C,D7),0),COLORGREEN;
E7:DRAWLINE(CURRBARSCOUNT=D8+1,C,ISLASTBAR,REF(C,D8),0),COLORGREEN;
E8:DRAWLINE(CURRBARSCOUNT=D9+1 ,C,ISLASTBAR,REF(C,D9),0),COLORGREEN;
E9:DRAWLINE(CURRBARSCOUNT=D10+1 ,C,ISLASTBAR,REF(C,D10),0),COLORGREEN;
HH:=MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(E,E1),E2),E3),E4),E5),E6),E7),E8),E9);
T:=BArslAST(C=CONST(HH));
DRAWLINE(CURRBARSCOUNT=CONST(T)+1,C,ISLASTBAR,REF(C,T),0),COLORYELLOW,LINETHICK2;