DRAWGBK(C>0, RGB(1,0,1),RGB(1,0,1),0,'0',0);
MTR:=EXPMEMA(MAX(MAX(HIGH-LOW,Abs(HIGH-REF(CLOSE,1))),ABS(REF(CLOSE,1)-LOW)),14);
HD :=HIGH-REF(HIGH,1);
LD :=REF(LOW,1)-LOW;
DMP:=EXPMEMA(IF(HD>0&&HD>LD,HD,0),14);
DMM:=EXPMEMA(IF(LD>0&&LD>HD,LD,0),14);
PDI:DMP*100/MTR,COLORWHITE,NODRAW;
mdi:DMM*100/MTR,COLORYELLOW,NODRAW;
ADX:EXPMEMA(ABS(MDI-PDI)/(MDI+PDI)*100,6)COLORMAGENTA;
ADXR:EXPMEMA(ADX,6)COLORGREEN;
MZD:=MAX(ADX,MAX(PDI,MDI));
MZX:=MIN(ADX,MIN(PDI,MDI));
高点:=REFDATE(HHV(MZD,120),DATE);
低点:=REFDATE(LLV(MZX,120),DATE);
STICKLINE(PDI>MDI,高点,低点,5,0)COLOR001050;
STICKLINE(PDI<MDI,高点,低点,5,0)COLOR404050;
DRAWBAND(PDI,RGB(150,50,50),MDI,RGB(0,50,100));
STICKLINE(ADX>ADXR,ADX,ADXR,1,0)COLORRED;
STICKLINE(ADX<ADXR,ADX,ADXR,1,0)COLORLIGREEN;
NOTEXT1:ADX,COLORMAGENTA;
NOTEXT2:ADXR,COLORGREEN;
STICKLINE(C>0,60,60,28,-1)COLORYELLOW;
STICKLINE(C>0,20,20,28,-1)COLORYELLOW;
DRAWTEXT(ISLASTBAR,ADX,' ←ADX'),COLORMAGENTA;
DRAWTEXT_FIX(1,0,0.00,0,'股价连续上涨到高位,ADX下穿ADXR或下穿60时卖出;'),COLORGREEN;
DRAWTEXT_FIX(1,0,0.10,0,'股价连续下跌到低位,ADX下穿ADXR或下穿60时买入;'),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.20,0,'股价在低位盘整过后,ADX上穿20时启动(上升);'),COLORWHITE;
DRAWTEXT_FIX(1,0,0.30,0,'股价在高位盘整过后,ADX上穿20时启动(下跌);'),COLORCYAN;
DRAWTEXT_FIX(1,0.55,0.00,0,'20轴附近 -- 红色背景 -- 出现红柱(或绿柱缩短)-- 可以买入;'),COLORWHITE;
DRAWTEXT_FIX(1,0.55,0.10,0,'红色背景(PDI>MDI):安全;'),COLORWHITE;