N:=3;M:=2;
MTR:=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&&HD>LD,HD,0),N);
DMM:=SUM(IF(LD>0&&LD>HD,LD,0),N);
PDI: DMP*100/MTR,LINETHICK3;
DRAWTEXT(ISLASTBAR,PDI,STRCAT6(' ---多方PDI ',CON2STR(PDI,2),'','','',''));
MDI: DMM*100/MTR;
ADX: MA(ABS(MDI-PDI)/(MDI+PDI)*100,M);
DRAWTEXT(ISLASTBAR,ADX,STRCAT6(' ---趋势ADX ',CON2STR(ADX,2),'','','',''));
ADXR:(ADX+REF(ADX,M))/2;
DRAWTEXT_FIX(1,0.01,0.01,0,'市场行情趋明显时效果理想。1.PDI线从下向上突破MDI线,新多头进场,做多;2.PDI线从上向下跌破MDI线,新空头进场,做空;
3.ADX值持续高于前一日时,行情将维持原趋势;4.ADX值递减,降到20以下且横向行进时,市场为盘整;5.ADX从上升倾向转为下降,行情即将反转');