N:=14;MM:=6;
MTR:=EXPMEMA(MAX(MAX(Abs(HIGH-LOW),ABS(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),N);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),N);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),N);
pdi:=DMP*100/MTR;
mdi:=DMM*100/MTR;
{ _最新股票指标公式}
多头线:PDI,COLORRED,LINETHICK2;
空头线:MDI,COLORCYAN,LINETHICK1;
顺势线_多或空:EXPMEMA(ABS(PDI-MDI)/(MDI+PDI)*100,MM),DOTLINE;
顺势线M:EXPMEMA(顺势线_多或空,MM),DOTLINE;