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;
D:=PDI-22;
K:=MDI-22;
A:=D-K;
STICKLINE(A>0 ,D,K,0,-1),COLORRED;
STICKLINE(A<=0,K,D,0,-1),COLORCYAN;
多:D,COLORWHITE;
空:K,COLORYELLOW;
ADX:EXPMEMA((PDI-MDI)/(MDI+PDI)*100,3),COLORMAGENTA;
ADXR:EXPMEMA(ADX,5),COLORGREEN;
趋势:EMA(ADX,13),DOTLINE,COLORGRAY;