MTR:=EXPMEMA(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:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),14);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),14);
pdi: DMP*100/MTR;
mdi: DMM*100/MTR;
ADX: EXPMEMA(ABS(MDI-PDI)/(MDI+PDI)*100,6);
ADXR:EXPMEMA(ADX,6);
DRAWBAND(PDI,RGB(240,10,90),MDI,RGB(0,91,0));
DRAWBAND(ADX,RGB(250,90,240),ADXR,RGB(600,240,50));