WR1:=100*(HHV(H,21)-C)/(HHV(H,21)-LLV(L,21));
WR2:=100*(HHV(H,42)-C)/(HHV(H,42)-LLV(L,42));
WR3:=100*(HHV(H,63)-C)/(HHV(H,63)-LLV(L,63));
WR4:=100*(HHV(H,84)-C)/(HHV(H,84)-LLV(L,84));
WR5:=100*(HHV(H,105)-C)/(HHV(H,105)-LLV(L,105));
WR6:=100*(HHV(H,126)-C)/(HHV(H,126)-LLV(L,126));
WR:(WR1+WR2+WR3+WR4+WR5+WR6)/6,COLORMAGENTA,LINETHICK2;
swr:sMA(wr,21,1),COLORAAAA00,DOTLINE;
KC:=MAX(MAX(ABS(H-L),ABS(H-REF(C,1))),ABS(REF(C,1)-L));
MTR:=EMA(KC+SLOPE(KC,21),21);
HD :=H-REF(H,1);
LD :=REF(L,1)-L;{}
DMP:=EMA(IF(HD>0&&HD>LD,HD,0)+SLOPE(IF(HD>0&&HD>LD,HD,0),21),21);
DMM:=EMA(IF(LD>0&&LD>HD,LD,0)+SLOPE(IF(LD>0&&LD>HD,LD,0),21),21);
PDI:DMP*100/MTR,COLORRED,LINETHICK2;
MDI:DMM*100/MTR,COLOR00CCCC,LINETHICK2;
MG:=ABS(PDI-MDI)/(MDI+PDI)*100;
ADX:EMA(MG+SLOPE(MG,14),14),COLORFFCCAA,DOTLINE;