0;100;N:=9;M1:=3;M2:=3;P:=9;
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);
pdi1:=DMP*100/MTR;
mdi1:=DMM*100/MTR;
STICKLINE(PDI1>=MDI1,0,100,5,0),COLOR495944;
DRAWBAND(PDI1,RGB(240,0,240),MDI1,RGB(0,190,150));
{ _通达信股票指标公式}
ADX1:=EXPMEMA(ABS(MDI1-PDI1)/(MDI1+PDI1)*100,6),LINETHICK0;
ADXR1:=EXPMEMA(ADX1,6),LINETHICK0;
PDI:PDI1,COLORFFFFFF,LINETHICK0;
MDI:MDI1,COLORFF00FF,LINETHICK0;
ADX:ADX1,COLORRED,LINETHICK0;
ADXR:ADXR1,COLOR00FF00,LINETHICK0;
STICKLINE(C>0,20,20,2,0),COLORRED;
STICKLINE(C>0,80,80,2,0),COLORFFFF00;
快线:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100,COLOR0000FF,LINETHICK2;
慢线:=SMA(快线,M1,1),COLORFFFF00,LINETHICK2;
空:=SMA(慢线,M2,1),COLORFFFF00,LINETHICK1;
牛股:IF(BArslAST(crOSS(慢线,空))<P AND BARSLAST(CROSS(空,慢线))<P AND CROSS(慢线,空) AND 慢线<20,35,0),STICK,COLORRED;
STICKLINE(牛股,0,60,1,0),COLOR00FF00;
DRAWTEXT(BARSLAST(CROSS(慢线,空))<P AND BARSLAST(CROSS(空,慢线))<P AND CROSS(慢线,空) AND 慢线<20,62,'牛股'),COLOR00FFFF;
BB:=IF(BARSLAST(CROSS(慢线,快线))>=3 AND CROSS(快线,慢线) AND 慢线<30,20,0);
AA:=IF(BARSLAST(CROSS(快线,慢线))>=4 AND CROSS(慢线,快线) AND 快线>50,20,0);
DRAWBAND(快线,RGB(255,60,0),慢线,RGB(0,202,209));
STICKLINE(ADX1>=ADXR1,ADX1,ADXR1,2,0),COLORFF1493;
STICKLINE(ADX1<ADXR1,ADX1,ADXR1,2,0),COLOR00BFFF;
买:STICKLINE(BB,0,20,1,0),COLOR00FFFF;
DRAWICON(BARSLAST(CROSS(慢线,快线))>=3 AND CROSS(快线,慢线) AND 慢线<30,20,23);
卖:STICKLINE(AA,80,100,1,0),COLOR00FFFF;
DRAWICON(BARSLAST(CROSS(快线,慢线))>=4 AND CROSS(慢线,快线) AND 快线>50,80,14);