N:=14;M:=6;
MTRA:=EXPMEMA(MAX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),N);
HDA :=HIGH-REF(HIGH,1);
LDA :=REF(LOW,1)-LOW;
DMPA:=EXPMEMA(IF(HDA>0&&HDA>LDA,HDA,0),N);
DMMA:=EXPMEMA(IF(LDA>0&&LDA>HDA,LDA,0),N);
pdi:DMPA*100/MTRA,LINETHICK2;
mdi:DMMA*100/MTRA,LINETHICK2;
ADX:EXPMEMA(ABS(MDI-PDI)/(MDI+PDI)*100,M),LINETHICK2;
ADXR:EXPMEMA(ADX,M),LINETHICK2;
{ _通达信股票指标公式}
XG:=PDI<5&&ADX>60,LINETHICK2,COLOR0000FF;
MDI选股:IF(XG,50,0),LINETHICK5,COLOR0000FF;
MA0:=MA(CLOSE,1);
MA1:=MA(CLOSE,2);
MA2:=MA(CLOSE,3);
MA3:=MA(CLOSE,4);
MA4:=MA(CLOSE,5);
MA5:=MA(CLOSE,6);
A00:SUM(MA0,5)/5,COLORRED,LINETHICK2;
A01:SUM(MA1,5)/5;
A02:SUM(MA2,5)/5;
A03:SUM(MA3,5)/5;
A04:SUM(MA4,5)/5;
A05:SUM(MA5,5)/5,COLORCYAN,LINETHICK2;
买11:=crOSS(C,A05);
DRAWICON(买11,A00,11);