N:=20;N1:=39;
MID:=(3*CLOSE+LOW+OPEN+HIGH)/6;
DKX:(20*MID+19*REF(MID,1)+18*REF(MID,2)+17*REF(MID,3)+
16*REF(MID,4)+15*REF(MID,5)+14*REF(MID,6)+
13*REF(MID,7)+12*REF(MID,8)+11*REF(MID,9)+
10*REF(MID,10)+9*REF(MID,11)+8*REF(MID,12)+
7*REF(MID,13)+6*REF(MID,14)+5*REF(MID,15)+
4*REF(MID,16)+3*REF(MID,17)+2*REF(MID,18)+REF(MID,20))/210,COLORYELLOW,LINETHICK2;
MADKX:MA(DKX,10),COLORYELLOW;
DRAWBAND(DKX,RGB(255,96,96),MADKX,RGB(0,224,224));
SWL:(expma(CLOSE,5)*7+EXPMA(CLOSE,10)*3)/10,COLORMAGENTA;
SWS:DMA(EMA(CLOSE,12),MAX(1,100*(SUM(vol,5)/(3*CAPITAL)))),COLORMAGENTA,DOTLINE;
STICKLINE(SWL>SWS,SWL,SWS,0.5,-1),COLORRED;
STICKLINE(SWL<SWS,SWL,SWS,0.5,-1),COLORWHITE;
箱顶:REF(HHV(H,N),1),COLORYELLOW,LINETHICK1;
箱底:REF(LLV(L,N),1),COLORYELLOW,LINETHICK1;
中线:(箱顶+箱底)/2,COLORYELLOW,DOTLINE;
{ _通达信股票指标公式}
MTR1:=MAX(MAX((HIGH-LOW),Abs(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR1:=EMA(MTR1,N1);
MID1:EMA(CLOSE,N1),COLORLIBLUE,DOTLINE;
UPBAND:MID1+1.618*ATR1,COLORLIBLUE;
DNBAND:MID1-1.618*ATR1,COLORLIBLUE;
bbi:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4,COLORRED,LINETHICK2;