通达信MDI指标选股源码公式
{MDI指标选股}
{参数: N 2 90 14, M 2 90 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;