SJTJ:=DATE<1590301;
maH:=(H*18+REF(H,1)*17+REF(H,2)*16+REF(H,3)*15+REF(H,4)*14+REF(H,5)*13+REF(H,6)*12+REF(H,7)*11+REF(H,8)*10+REF(H,9)*9+REF(H,10)*8+REF(H,11)*7+REF(H,12)*6+REF(H,13)*5+REF(H,14)*4+REF(H,15)*3+REF(H,16)*2+REF(H,17)*1)/171;
MAL:=(L*18+REF(L,1)*17+REF(L,2)*16+REF(L,3)*15+REF(L,4)*14+REF(L,5)*13+REF(L,6)*12+REF(L,7)*11+REF(L,8)*10+REF(L,9)*9+REF(L,10)*8+REF(L,11)*7+REF(L,12)*6+REF(L,13)*5+REF(L,14)*4+REF(L,15)*3+REF(L,16)*2+REF(L,17)*1)/171;
MA5:=MA(CLOSE,5);
MA10:=MA(CLOSE,10);
MA20:=MA(CLOSE,20);
MA60:=MA(CLOSE,60);
DK:= SJTJ AND( CLOSE>=MAH OR (C>MA5 AND C>MA10 AND C>MA20 AND C>MA60));
KK:= SJTJ AND( MAL>CLOSE OR (C<MA5 AND C<MA10 AND C<MA20 AND C<MA60));
DK1:=BArslAST(DK);
KK1:=BARSLAST(KK);
DK2:=BARSLAST(crOSS(KK1,DK1));
KK2:=BARSLAST(CROSS(DK1,KK1));
HS:=DK2<KK2;
LS:=KK2<DK2;
W2:=OPEN-CLOSE;
HT:=IF(OPEN>CLOSE,OPEN,CLOSE);
LT:=IF(OPEN<CLOSE,OPEN,CLOSE);
STICKLINE(HS,REFDATE(HHV(H,0),DATE),REFDATE(LLV(L,0),DATE),6,0),COLOR001050;
STICKLINE(LS,REFDATE(HHV(H,0),DATE),REFDATE(LLV(L,0),DATE),6,0),COLORBLacK;
STICKLINE(W2>0 AND HS,OPEN,CLOSE,2,0),COLORWHITE;
STICKLINE(W2>0 AND HS,OPEN,H,0.0,0),COLORWHITE;
STICKLINE(W2>0 AND HS,C,L,0.0,0),COLORWHITE;
STICKLINE(W2<=0 AND HS,OPEN,CLOSE,2,1),COLORWHITE;
STICKLINE(W2<=0 AND HS,O,L,0.0,0),COLORWHITE;
STICKLINE(W2<=0 AND HS,C,H,0.0,0),COLORWHITE;
STICKLINE(W2>0 AND LS,OPEN,CLOSE,2,0),COLORCYAN;
STICKLINE(W2>0 AND LS,OPEN,H,0.0,0),COLORCYAN;
STICKLINE(W2>0 AND LS,C,L,0.0,0),COLORCYAN;
STICKLINE(W2<=0 AND LS,OPEN,CLOSE,2,1),COLORCYAN;
STICKLINE(W2<=0 AND LS,C,H,0.0,0),COLORCYAN;
STICKLINE(W2<=0 AND LS,O,L,0.0,0),COLORCYAN;
DRAWTEXT(HS=1 AND REF(LS,1),LOW*0.985,12),COLORBLUE;
DRAWTEXT(LS=1 AND REF(HS,1),H*1.009,13),COLORBLUE;
DRAWNUMBER(ISLASTBAR AND LS,MAH,MAH),COLORBLUE;
DRAWNUMBER(ISLASTBAR AND HS,MAL,MAL),COLORBLUE;
DRAWNUMBER(ISLASTBAR AND LS,MAH,MAH),COLORBLUE;
DRAWNUMBER(ISLASTBAR AND HS,MAL,MAL),COLORBLUE;
最新价:IF(SJTJ, C,DRAWNULL),LINETHICK0,COLORBLUE;
趋势线:=(MAH+MAL)/2 COLORCYAN,LINETHICK2;
趋势线上升:IF(HS,趋势线,DRAWNULL),LINETHICK2,COLORWHITE;
趋势线下降:IF(LS,趋势线,DRAWNULL),LINETHICK2,COLORCYAN;
DRAWICON(HS,趋势线*0.995,1);
DRAWICON(LS,趋势线*1.005,2);
DRAWNUMBER(ISLASTBAR ,C,C),COLORRED;
DRAWTEXT_FIX(ISLASTBAR,0,0,0,ZDBLOCK),COLORBLUE;
AAA:=CONST(HHV(H,50));
PL5:=HHV(H,45);
AZ:=BARSCOUNT(CLOSE);
AH:=HHV(HIGH,200);
AL:=LLV(LOW,200);
B0:=(AH-AL)/40;
BL1:=HIGH+B0;
BL2:=LOW-B0;
STICKLINE((AZ+0)/34=FLOOR((AZ+0)/34),BL2,BL2-2*B0,3,0),COLORFFFFFF;
DRAWTEXT((AZ+0)/34=FLOOR((AZ+0)/34),BL2-2.2*B0,'时间窗'),COLORFFFFFF;
Y:=(HIGH+LOW)/2;
ao:=MA(Y,5)-MA(Y,21);
DU0:=CROSS(AO,0);
UD0:=CROSS(0,AO);
TDU0:=BARSLAST(DU0);
TUD0:=BARSLAST(UD0);
DU3:=REF(DU0,1);
UD3:=REF(UD0,1);
TDU3:=BARSLAST(DU3);
TUD3:=BARSLAST(UD3);
劫:IF(TDU3<TUD3,REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3)),LINETHICK2,COLORBLUE;
WL1:=REVERSE((HHV(HIGH,10)-CLOSE)/(HHV(HIGH,10)-LLV(LOW,10)))+1;
DRAWTEXT_FIX(ISLASTBAR AND WL1>=REF(WL1,1) AND WL1>=0.55,0.45,0,1,'★'),COLORBLUE;
DRAWTEXT_FIX(ISLASTBAR AND WL1>=REF(WL1,1) AND WL1>=0.65,0.48,0,1,'★'),COLORBLUE;
DRAWTEXT_FIX(ISLASTBAR AND WL1>=REF(WL1,1) AND WL1>=0.75,0.51,0,1,'★'),COLORBLUE;
DRAWTEXT_FIX(ISLASTBAR AND WL1>=REF(WL1,1) AND WL1>=0.85,0.54,0,1,'★'),COLORBLUE;
DRAWTEXT_FIX(ISLASTBAR AND WL1>=REF(WL1,1) AND WL1>=0.95,0.57,0,1,'★'),COLORBLUE;
TY:=C;
AA1:=REF(TY,10)=HHV(TY,2*10+1);
BB1:=FILTER(AA1,10);
C1:=BACKSET(BB1,10+1);
HD:=FILTER(C1,10);
AA2:=REF(TY,10)=LLV(TY,2*10+1);
BB2:=FILTER(AA2,10);
CC2:=BACKSET(BB2,10+1);
LD:=FILTER(CC2,10);
前期高位:REF(C,BARSLAST(HD)),COLORYELLOW,COLORLIMAGENTA;
STICKLINE(C,前期高位,前期高位,8,0),COLORLIMAGENTA;
前期低位:REF(L,BARSLAST(LD)),COLORFF00FF,LINETHICK1,COLORCYAN;
{非常棒}
ema13:=EMA(C,13),COLORRED;
EMA21:=EMA(C,21),COLORBLUE;
EMA34:=EMA(C,34),COLORFF00FF;
EMA60:=MA(C,60),COLORFFCC66;
VAR2:=(2*CLOSE+HIGH+LOW)/4;
VAR3:=IF(YEAR>=2099 AND MONTH>2,0,1);
VAR4:=LLV(LOW,5); VAR5:=HHV(HIGH,4);
散户:=EMA((VAR2-VAR4)/(VAR5-VAR4)*100,4)*VAR3;
庄家:=EMA(0.667*REF(散户,1)+0.333*散户,2)*VAR3;
DRAWTEXT(CROSS(散户,庄家) AND 散户<30,L-0.05,'←买'),COLORLICYAN;
DRAWTEXT(CROSS(庄家,散户) AND 散户>70,H+0.05,'←抛'),COLORCYAN;
DRAWICON(CROSS(散户,庄家) AND 散户<30,L-0.05,1);
DRAWICON(CROSS(庄家,散户) AND 散户>70,H+0.05,2);
VAR9:=CLOSE-REF(CLOSE,5);
VARA:=EMA(EMA(VAR9,5),5)/EMA(EMA(Abs(VAR9),5),5);
VARC:=EMA(EMA(VAR9,20),20)/EMA(EMA(ABS(VAR9),20),20);
卖出:=IF(VARA>0 AND CROSS(VARC,VARA),90,100);
DRAWICON(卖出<0,H+0.05,2);
买线:=EMA(CLOSE,2);
卖线:=EMA(SLOPE(CLOSE,21)*20+CLOSE,42);
底1:IF(CROSS(买线,卖线),L-0.02,DRAWNULL),CIRCLEDOT,LINETHICK3,COLORLIMAGENTA;
DRAWTEXT(CROSS(买线,卖线)AND V/REF(V,1)>=2.0,L*0.98,'起爆') ,COLORLIMAGENTA;
顶:IF(CROSS(80,rsi)*30,H+0.02,DRAWNULL),CIRCLEDOT,LINETHICK5,COLORBLUE;
VC:=((CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100+(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100+(CLOSE-MA (CLOSE,32))/MA(CLOSE,32)*100)/3;
顶1:IF(VC>20 AND FILTER(VC< REF(VC,1),5),H+0.02,DRAWNULL),POINTDOT,LINETHICK9,COLORCYAN;
A0:=(L+H+C*2)/4;
A1B:EMA(A0,14),COLORYELLOW,LINETHICK2;
A2B:=EMA(A0,25),COLORLIGREEN,LINETHICK2;
A1X:=(A1B-REF(A1B,1))/REF(A1B,1)*100,NODRAW;
A2X:=(A2B-REF(A2B,1))/REF(A2B,1)*100,NODRAW;
看多:IF(A1X>=0 AND BARSLAST(CROSS(A1X,0))>0,REF((C+O)/2,BARSLAST(CROSS(A1X,0))),DRAWNULL),COLORLIMAGENTA,LINETHICK4;
逃顶:IF(A1X<0 AND BARSLAST(CROSS(0,A1X))>0,REF((C+O)/2,BARSLAST(CROSS(0,A1X))),DRAWNULL),COLORGREEN,LINETHICK4;
买入持股:IF(A1X>=0,A1B,DRAWNULL)COLORWHITE,LINETHICK3;
卖出空仓:IF(A1X<0 AND A2X<0,A1B,DRAWNULL)COLORCYAN,LINETHICK3;
STICKLINE(CROSS(A1X,0),H,L,0,0 ),COLOR9933FF;
STICKLINE(CROSS(A1X,0),C,O,2,0 ),COLOR0000CC;
STICKLINE(CROSS(A1X,0),C,O,1,0 ),COLOR0033FF;
STICKLINE(CROSS(0,A1X),L,H,0,0 ),COLOR66CC33;
difF :=EMA(CLOSE,7) - EMA(CLOSE,13);
DEA := EMA(DIFF,3);
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
RSV:=(CLOSE-LLV(LOW,18))/(HHV(HIGH,18)-LLV(LOW,18))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);{KDJ底背离}
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),7,1)/SMA(ABS(CLOSE-LC),7,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),14,1)/SMA(ABS(CLOSE-LC),14,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
TYB:=(HIGH + LOW + 2*CLOSE)/4;
cci4:=(TYB-MA(TYB,28))/(0.015*AVEDEV(TYB,28));
B4:=BARSLAST(NOT(MA(C,5)<MA(C,10)<=5) AND CCI4>REF(CCI4,1) AND CROSS(CCI4,-100));
底背离:=((B1 AND B2) OR (B2 AND B3) OR (B1 AND B3) OR ( B4 AND CCI4<-90) ) AND D<20 ;
DRAWICON(底背离,(LOW * 0.98),1);
DRAWTEXT(底背离,(LOW * 0.97),'金底背离'),COLORBLUE;
XL1:=(MA(LOW,2) * 0.96);
XL2:=(MA(LOW,26) * 0.85);
XL3:(((REF(XL1,1) < XL2) AND (REF(XL1,1) < XL1)) AND (REF(XL1,1) < REF(XL1,2)));
DRAWICON(XL3,L*0.99,1);
DRAWTEXT(XL3,L*0.99,'短进'),COLORBLUE;
LCD:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LCD,0),4.1,1)/SMA(ABS(CLOSE-LCD),4.1,1)*100;
建仓:CROSS(RSI,11),COLORWHITE;
DRAWICON(建仓,H*1.01,1);
DRAWTEXT(建仓,H*1.02,'建仓'),COLORWHITE;