N:=45;
M:=15;
MTRD:=SUM(maX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),N);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=SUM(IF(HD>0 AND HD>LD,HD,0),N);
DMM:=SUM(IF(LD>0 AND LD>HD,LD,0),N);
pdi:=DMP*100/MTRD;
mdi:=DMM*100/MTRD;
U:=BArslAST(crOSS(MDI,30));
D:=BARSLAST(CROSS(PDI,30));
涨:IF(U>D,0.2,DRAWNULL),COLORWHITE,LINETHICK3;
跌:IF(D>U,-0.2,DRAWNULL),COLORCYAN,LINETHICK3;