MTR:=EMA(MAX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),13);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),13);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),13);
pdi:=DMP*100/MTR;
mdi:=DMM*100/MTR;
ADX:=EXPMEMA((PDI-MDI)/(MDI+PDI)*100,3);
ADXR:=EXPMEMA(ADX,5);
红箭头:crOSS(ADX,ADXR);