M1:=3;
M2:=5;
TR=EMA(MAX(MAX(HIGH-LOW,ABS(HIGH-REF(CLOSE,1))),ABS(LOW-REF(CLOSE,1))),M1);
HD=HIGH-REF(HIGH,1);
LD=REF(LOW,1)-LOW;
DMP=EMA(IF(HD>0 AND HD>LD,HD,0),M1);
DMM=EMA(IF(LD>0 AND LD>HD,LD,0),M1);
DI1:=DMP*100/TR;
DI2:=DMM*100/TR;
多头线:DI1,colorred,LINETHICK2;
空头线:DI2,colorcyan,LINETHICK1;
顺势线_多或空:EMA(ABS(DI2-DI1)/(DI1+DI2)*100,M2),DOTLINE;
顺势线M:EMA(顺势线_多或空,M2),DOTLINE;