{指标介绍:
1.PDI线从下向上突破MDI线,新多头进场,做多;
2.PDI线从上向下跌破MDI线,新空头进场,做空;
3.ADX值持续高于前一日时,行情将维持原趋势;
4.ADX值递减,降到20以下且横向行进时,市场为盘整;
5.ADX从上升倾向转为下降,行情即将反转。
}
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;
mdi:DMM*100/MTR;
ADX:MA(ABS(MDI-PDI)/(MDI+PDI)*100,M);
ADXR:(ADX+REF(ADX,M))/2;