PDI:EMA(MAX(CLOSE-REF(CLOSE,1),0),14)/EMA(ABS(CLOSE-REF(CLOSE,1)),14)*100;

MDI:EMA(MAX(REF(CLOSE,1)-CLOSE,0),14)/EMA(ABS(CLOSE-REF(CLOSE,1)),14)*100;

ADX_VAL:EMA(ABS(PDI-MDI)/(PDI+MDI)*100,14);

BUYSIGNAL:=CROSS(PDI, MDI) AND ADX_VAL>20 AND HOUR*100+MINUTE<=935;

STICKLINE(BUYSIGNAL, LOW, HIGH*999, 3, 0), COLORRED;

DRAWICON(BUYSIGNAL, LOW*99, 23);