MTR:=EMA(MAX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EMA(IF(HD>0 AND HD>LD,HD,0),14);
DMM:=EMA(IF(LD>0 AND LD>HD,LD,0),14);
pdi:=DMP*100/MTR;
mdi:=DMM*100/MTR;
ADX:=EMA(ABS(MDI-PDI)/(MDI+PDI)*100,6);
ADXR:=EMA(ADX,6);
NX:=PDI/(PDI+MDI)*100;
MM1:=SUM(IF(H-REF(C,1)>0,(H-REF(C,1))+(C-L),C-L),8);
MM2:=SUM(IF(REF(C,1)-L>0,(REF(C,1)-L)+(H-C),H-C),8);
DMK:=MM1/(MM1+MM2)*100;
BD:=(NX+DMK)/2;
MBD:EMA(BD,5),COLORGREEN;
IF(MBD>=REF(MBD,1),MBD,DRAWNULL),COLORRED;
STICKLINE(C>0,75,75,4,0),COLORC6C600;
STICKLINE(C>0,50,50,1,0),COLORWHITE;
STICKLINE(C>0,25,25,4,0),COLORYELLOW;