波段顶底主图(主图叠加)
生命线:MA(CLOSE,21),COLORRED,LINETHICK1;
IF(C>=生命线,生命线,DRAWNULL),COLORRED,LINETHICK2;
IF(C<生命线,生命线,DRAWNULL),COLORBLUE,LINETHICK2;
MA80:MA(CLOSE,80)COLORLIGREEN,LINETHICK2;
MA160:MA(CLOSE,160)COLORMAGENTA,LINETHICK2;
选股1:=CROSS(C,MA80) AND CROSS(C,MA160) AND CROSS(C,生命线)COLORBLUE;
DRAWICON(选股1,L*0.997,1)COLORBLUE;
A1:=C>REF(C,4);
NT:=BARSLASTCOUNT(A1);
TJ11:=NT=9;
TJ13:=ISLASTBAR AND BETWEEN(NT,5,8);
AY:=(BACKSET(TJ11>0,9) OR BACKSET(TJ13>0,NT))*NT;
DRAWTEXT(AY>0,H*1.002,VAR2STR(AY,0)),COLORRED;
DRAWTEXT(NT=9,H*1.002,'9'),COLORBLUE;
B1:=C<REF(C,4);
NT0:=BARSLASTCOUNT(B1);
TJ21:=NT0=9 ;
TJ23:=ISLASTBAR AND BETWEEN(NT0,5,8);
AY1:=(BACKSET(TJ21>0,9) OR BACKSET(TJ23>0,NT0))*NT0;
DRAWTEXT(AY1>0,L*0.99,VAR2STR(AY1,0)),COLORBLACK;
DRAWTEXT(NT0=9,L*0.99,'9'),COLORLIMAGENTA;
{======行业概念======}
Z11:=STRCAT(DYBLOCK,' ');
Z22:=STRCAT(Z11,HYBLOCK);
Z33:=STRCAT(Z22,' ');
Z44:=STRCAT(Z33,GNBLOCK);
Z55:=STRCAT(Z44,' ');
Z66:=STRCAT(Z55,FGBLOCK);
DRAWTEXT_FIX(ISLASTBAR,0.10,0.99,0,STRCAT(Z66,ZHBLOCK)),COLORYELLOW;
{顶底指标}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1)COLORRED,LINETHICK1;
D:=SMA(K,3,1)COLORBLUE,LINETHICK1;
J:=3*K-2*D,COLORLICYAN,LINETHICK2;
顶背离:=IF(H>REF(HHV(H,10),1) AND J<HHV(J,15) AND (CROSS(100,J)),1,0),COLORBLUE,NODRAW;
顶背离1:=IF(H>REF(HHV(H,10),1) AND J<HHV(J,15) AND J<REF(J,1),1,0)AND J<100,COLORBLUE,NODRAW;
DRAWTEXT(顶背离,H,'顶'),COLORLIMAGENTA;
DRAWTEXT(顶背离1,H,'顶'),COLORLIMAGENTA;
DRAWICON(J<100 AND REF(J,1)>100,H,2);
底背离:=IF(L<REF(L,1) AND J>REF(LLV(J,15),1) AND J>REF(J,1) AND J<=25 AND J>0,1,0),COLORMAGENTA,NODRAW;
底背离1:=IF(L<REF(L,1) AND J>LLV(J,15) AND CROSS(J,0),1,0),COLORLIGREEN,NODRAW;
J值上拐:=IF(CROSS(J,0),1,0),COLORBLACK,NODRAW;
DRAWTEXT(底背离,L*0.99,'底'),COLORRED;
DRAWTEXT(J值上拐,L*0.99,'底'),COLORRED;
DRAWTEXT(底背离1,L*0.99,'底'),COLORRED;
TC1:=IF(H=HHV(H,48),H,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1)));
BC1:=IF(L=LLV(L,48),L,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位}
HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位}
DRAWTEXT(LP,L*0.99,'↖波段底'),COLORLIGREEN;{波段底文字提示}
DRAWTEXT(HP,H*1.0051,'←波段顶'),COLORMAGENTA;{波段顶文字提示};
STICKLINE(HP,OPEN,CLOSE,0.5,0),COLORGREEN;
STICKLINE(LP,OPEN,CLOSE,0.5,0),COLORYELLOW;