TR:=SMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),N,1);
HD:=HIGH-REF(HIGH,1);
LD:=REF(LOW,1)-LOW;
DMP:=SMA(IF(HD 0 AND HD LD,HD,0),N,1);
DMM:=SMA(IF(LD 0 AND LD HD,LD,0),N,1);
PDI:DMP*200/TR,COLORRED;
MDI:DMM*200/TR,COLORBLUE;
ADX:SMA(ABS(MDI-PDI)/(MDI+PDI)*200,M,1),COLORYELLOW;
ADXR:(ADX+REF(ADX,M))/2,COLORMAGENTA,LINETHICK2;
IF(ADX ADXR,ADXR,0),COLOR00FF00,LINETHICK2;
IF(PDI REF(PDI,1),PDI,0),COLORBLUE,LINETHICK1;
IF(MDI REF(MDI,1),MDI,0),COLORRED,LINETHICK1;
STICKLINE(ADX =REF(ADXR,1),ADX,ADXR,1,0),COLOR00FF00;
STICKLINE(ADX REF(ADXR,1),ADX,ADXR,1,0),COLORMAGENTA;
STICKLINE(REF(PDI,1) PDI,PDI,REF(PDI,1),1,0),COLORRED;
STICKLINE(REF(PDI,1) PDI,PDI,REF(PDI,1),1,0),COLORBLUE;
STICKLINE(REF(MDI,1) MDI,MDI,REF(MDI,1),1,0),COLORRED;
STICKLINE(REF(MDI,1) MDI,MDI,REF(MDI,1),1,0),COLORBLUE;
{传统MDI加进四条线 }
CD0:16,POINTDOT;
CD1:30,POINTDOT;
TD0:60,POINTDOT;
TD1:80,POINTDOT;
DRAWTEXT(CROSS( PDI,CD0), CD0,'●金'),COLORMAGENTA;
DRAWTEXT(CROSS( TD0,PDI), PDI,'●死'),COLORBLUE;
DRAWTEXT(CROSS( ADX,CD0), CD0,'●金'),COLORMAGENTA;
DRAWTEXT(CROSS( TD0,ADX), ADX,'●死'),COLORBLUE;
DRAWTEXT(CROSS( PDI,MDI), MDI,'★金'), COLORYELLOW;
DRAWTEXT(CROSS( MDI,PDI), PDI,'★死'), COLORGREEN;
DRAWTEXT(CROSS( ADX,ADXR), ADXR,'★金'), COLOR000999 ;
DRAWTEXT(CROSS( ADXR,ADX), ADX,'★死'), COLORCYAN;