{自用DMI}
N:=15;
M:=5;
TR := SUM(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N);
HD := HIGH-REF(HIGH,1);
LD := REF(LOW,1)-LOW;
DMP:= SUM(IF(HD>0 AND HD>LD,HD,0),N);
DMM:= SUM(IF(LD>0 AND LD>HD,LD,0),N);
PDI: DMP*100/TR;
MDI: DMM*100/TR;
ADX: MA(ABS(MDI-PDI)/(MDI+PDI)*100,M);
ADXR:(ADX+REF(ADX,M))/2;
低吸:5,COLORRED;
盘下:20;
盘上:40;
风险:60,POINTDOT;
转向:75,COLORGREEN;
DRAWTEXT(CROSS(PDI,5) AND ADX>60,PDI,'反多'),COLORYELLOW;
DRAWTEXT(CROSS(MDI,5) AND ADX>60,MDI,'反空'),COLORgreen;
DRAWTEXT(CROSS(75,ADX),ADX,'转向'),COLORred;
DRAWICON(CROSS(PDI,MDI) AND CROSS(ADX,ADXR),ADX,1);
DRAWICON(CROSS(MDI,PDI) AND CROSS(ADX,ADXR),ADX,2);