N:=14;
M:=9;
T:=120;
AN1:=20;
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;
mdi: DMM*100/MTR;
ADX: MA(ABS(MDI-PDI)/(MDI+PDI)*100,M) NODRAW ;
ADXR:(ADX+REF(ADX,M))/2 NODRAW;
X轴:20.00,COLORRED,LINETHICK2;
AA1:=REF(PDI,AN1)=LLV(PDI,2*AN1+1);
QY1:=BacKSET(AA1,AN1+1);
ACC1:=FILTER(QY1,AN1) AND PDI=LLV(PDI,AN1+1);
JQS:=crOSS(BACKSET(BARSTATUS=2,SUMBARS(ACC1,1)),0.5);
YQS:=CROSS(BACKSET(BARSTATUS=2,SUMBARS(ACC1,2)),0.5);
cyqS:=CROSS(BACKSET(BARSTATUS=2,SUMBARS(ACC1,3)),0.5);
TJ1:=CROSS(PDI,20) NODRAW;
TJ2:=BACKSET(TJ1,BArslAST(CROSS(PDI,20))+1);
TJ3:=FILTER(TJ2,BARSLAST(CROSS(PDI,20)));
TJ4:=CROSS(BACKSET(BARSTATUS=2,SUMBARS(TJ3,2)),0.5);
上穿距今:BARSLAST(CROSS(PDI,20)) NODRAW;
近趋势线:DRAWLINE(JQS,PDI,TJ4,20,1),COLORYELLOW,LINETHICK2;
远趋势线:DRAWLINE(YQS,PDI,TJ4,20,1),COLORMAGENTA,LINETHICK2;
超远趋势线:DRAWLINE(CYQS,PDI,TJ4,20,1),COLORRED,LINETHICK2;