MA5:=MA(C,5);
MA6:=MA(C,6);
MA10:=MA(C,10);
MA20:=MA(C,20);A2:=REF(MA20,1);J1:=(MA20-A2)/A2*100;MJ1:=MA(J1,3);
MA30:=MA(C,30);
MA60:=MA(C,60);
MA120:=MA(C,120);
DRAWTEXT(CROSS("KDJ.D"(9,5,5),"KDJ.K"(9,5,5)) AND "KDJ.D"(9,5,5)>88 AND J1<MJ1 AND COUNT(J1>1,3)>=1,H*1.005,'出'),COLORGREEN;
DRAWTEXT(CROSS("KDJ.D"(9,9,9),"KDJ.K"(9,9,9)) AND "KDJ.D"(9,9,9)>60 AND "KDJ.J"(85,15,15)>90,H*1.03,'顶'),COLORGREEN;
买线:=EMA(C,2),COLORRED;
卖线:=EMA(SLOPE(C,21)*45+C,90),COLORYELLOW;
BU:=CROSS(买线,卖线);
SEL:=CROSS(卖线,买线);
STICKLINE(买线>=卖线,CLOSE,OPEN,2,0),COLORRED;
STICKLINE(买线>=卖线,LOW,HIGH,0,0),COLORRED;
STICKLINE(买线<卖线,CLOSE,OPEN,2,0),COLOR00FFFF;
STICKLINE(买线<卖线,LOW,HIGH,0,0),COLOR00FFFF;
MID:=(1*CLOSE+LOW+OPEN+HIGH)/4;
牛线:(20*MID+19*REF(MID,5)+18*REF(MID,6)+17*REF(MID,7)+16*REF(MID,8)+15*REF(MID,9)+14*REF(MID,10)+13*REF(MID,11)+12*REF(MID,12)+11*REF(MID,13)+10*REF(MID,14)+9*REF(MID,15)+8*REF(MID,16)+7*REF(MID,17)+6*REF(MID,18)+5*REF(MID,19)+4*REF(MID,20)+3*REF(MID,21)+2*REF(MID,22)+REF(MID,23))/210,COLORRED;
马线:MA(牛线,10),COLORWHITE;
DRAWBAND(牛线,RGB(255,0,0),马线,RGB(0,0,255));
卖副图
DIFF:=EMA(CLOSE,1)-EMA(CLOSE,49);
DEA:=EMA(DIFF,99);
多头:STICKLINE(DIFF>DEA,C,O,6,0),COLORRED;
STICKLINE(DIFF>DEA,H,L,0,0),COLORRED;
空头:STICKLINE(DIFF<=DEA,C,O,6,0), ;
STICKLINE(DIFF<=DEA,H,L,0,0), ;
DRAWTEXT(CROSS(DEA,DIFF),H+0.2,'卖'),COLORGREEN;