N:=14;
均价:=(2*C+(H-L)/2+L+o)/4;
价差:=SUM(均价-REF(均价,1),3)/3;
实价:=(均价+价差);
TR0:=SMA(MAX(MAX(实价-均价,ABS(实价-REF((实价+均价)/2,1))),ABS(均价-REF((实价+均价)/2,1))),N,1);
HD:=实价-REF(实价,1);
LD:=REF(均价,1)-均价;
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*100/TR0,COLORRED;
MDI:DMM*100/TR0,COLORGREEN;
ADX:SMA(ABS(MDI-PDI)/(MDI+PDI)*100,N/2,1),COLORWHITE;
10,LINEDOT,COLORGRAY;
30,COLORYELLOW;
50,LINEDOT,COLORMAGENTA;