obv:=SUM(IF(CLOSE>REF(CLOSE,1),vol,IF(CLOSE<REF(CLOSE,1),-VOL,0)),0)/100000;
obv1:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,1);
obv2:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,2);
obv3:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,3);
obv4:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,4);
obv5:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,5);
obv6:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,6);
obv7:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,7);
obv8:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,8);
obv9:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,9);
obv10:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,10);
obv11:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,11);
obv12:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,12);
obv13:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,13);
obv14:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,14);
obv15:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,15);
obv16:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,16);
obv17:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,17);
obv18:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,18);
obv19:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,19);
obv20:=ma(SUM(IF(CLOSE>REF(CLOSE,1),VOL,IF(CLOSE<REF(CLOSE,1),-VOL,0)),1)/10000,20);
obvzh1:=(obv1*20+obv2*19+obv3*18+obv4*17+obv5*16+obv6*15+obv7*14+obv8*13+obv9*12+obv10*11+obv10*11+obv12*9+obv13*8+obv14*7+obv15*6+obv16*5+obv17*4+obv18*3+obv19*2+obv20*1)/210;
{obvzh:=EMA(((SLOPE(obv,21) * 20) + obv),42);
obvm:=ema(obv,3);}
obvj:=SMA(obvzh1,2,1);
obvj2:sma(obvj,2,1);
obvj3:sma(obvj2,5,1);
obvj4:ma(obvj3,3);
{stickline(obvj>=ref(obvj,1),obvj,ref(obvj,1),8,1),colorred,;
stickline(obvj<ref(obvj,1),obvj,ref(obvj,1),8,0),colorff9900;}
opent:=ref(obvj,1);
closet:=ref(obvj,0);
B0:=REF(CLOSEt-OPENT,2);
B1:=REF(CLOSET,1);
B2:=REF(CLOSET,2);
B3:=REF(CLOSET,3);
B4:=REF(CLOSET,4);
CMAX:=MAX(MAX(MAX(CLOSET,B1),B2),B3);
CMIN:=MIN(MIN(MIN(CLOSET,B1),B2),B3);
STICKLINE(CLOSET=CMAX AND (B1>=B2 OR B1>=B3) OR B1=CMAX AND (B2=CMIN OR B3=CMIN) AND CLOSET>=B2 OR B2=CMAX AND B3=CMIN AND CLOSET>=B1 OR B3=CMAX AND CLOSET>=B1 AND CLOSET>=B2,B1,CLOSET,5,1),colorred;
STICKLINE(CLOSET=CMAX AND B1=CMIN,B2,CLOSET,5,1),colorred;
STICKLINE(CLOSET=CMIN AND (B1<B2 OR B1<B3) OR B1=CMIN AND (B2=CMAX OR B3=CMAX) AND CLOSET<B2 OR B2=CMIN AND B3=CMAX AND CLOSET<B1 OR B3=CMIN AND CLOSET<B1 AND CLOSET<B2,B1,CLOSET,5,0),colorgreen;
STICKLINE(B1=CMAX AND CLOSET=CMIN,B2,CLOSET,5,0),colorgreen;
STICKLINE(B1=CMIN AND CLOSET>=B2 OR (B2=CMIN AND B1<=B3 OR B3=CMIN AND B1<=B2) AND B2<B4 AND CLOSET>=B1,B1,B2,5,0),colorgreen;
STICKLINE(B1=CMAX AND CLOSET<B2 OR (B2=CMAX AND B1>B3 OR B3=CMAX AND B1>B2) AND B2>=B4 AND CLOSET<B1,B1,B2,5,1),colorred;