N:=89;
HH:=CONST(HHV(H,N));
LL:=CONST(LLV(L,N));
MM:=CONST(HH/2+LL/2);
CC:=CONST(C),crOSSDOT;
YY:=CONST(IF(CC>=MM,LL-(HH-LL)*0.2,HH+(HH-LL)*0.2)),POINTDOT;
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
macd:=(DIF-DEA)*2,COLORSTICK;
MHH:=CONST(HHV(MacD,N));
MLL:=CONST(LLV(MACD,N));
MMM0:=MHH/2-MLL/2; MMM:=IF(MMM0<(HH-LL)*0.1,(HH-LL)*0.1,MMM0);
STICKLINE(0=0,YY+MMM,YY-MMM,5,0),COLOR444444;
STICKLINE(MACD>=0 AND MACD>REF(MACD,1),YY,YY+MACD,0.2,0),COLORRED;
STICKLINE(MACD>=0 AND MACD<REF(MACD,1),YY,YY+MACD,0.2,0),COLORFFFF00;
STICKLINE(MACD<0 AND MACD<REF(MACD,1), YY,YY+MACD,0.2,0),COLOR00FF00;
STICKLINE(MACD<0 AND MACD>REF(MACD,1), YY,YY+MACD,0.2,0),COLOR00FFFF;
RSVZ:=((CLOSE-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13))-0.5)/100;
KX:=SMA(RSVZ,4,1);
DX:=SMA(KX,4,1);
JX:=3*KX-2*DX;
JJ:=(JX/0.005)*MMM;
STICKLINE(JX>REF(JX,1),YY+REF(JJ,1),YY+JJ,2.0,0),COLORMAGENTA;
STICKLINE(JX<REF(JX,1),YY+REF(JJ,1),YY+JJ,2.0,0),COLORGREEN;
SAR1:=IF(CLOSE<sar(2,3,10),SAR(2,3,10),0);
SAR2:=IF(CLOSE<SAR(4,2,20),SAR(4,2,20),0);
SARE:=IF(CLOSE>SAR(3,3,20),SAR(3,3,20),0);
SARA:=IF(CLOSE>SAR(4,2,10),SAR(4,2,10),0);
空仓:IF(MIN(SAR1,SAR2)>0,(SAR1+SAR2)/2,IF(SAR1+SAR2=0,DRAWNULL,SAR1+SAR2)){,CIRCLEDOT},COLORGREEN,LINETHICK5;
持股:IF(MIN(SARE,SARA)>0,(SARE+SARA)/2,IF(SARE+SARA=0,DRAWNULL,SARE+SARA)){,CIRCLEDOT},COLORMAGENTA,LINETHICK5;
MA1:C,COLORYELLOW,NODRAW;
MA3:MA(((3*C+L+O+H)/6),3),COLORYELLOW,NODRAW;
bbi:(MA(C,3)+MA(C,6)+MA(C,12)+MA(C,24))/4,COLORWHITE;
BB5:(MA(C,15)+MA(C,30)+MA(C,60)+MA(C,120))/4,COLORWHITE;
IF(C>BB5,BB5,DRAWNULL),COLORRED;
IF(C<BB5,BB5,DRAWNULL),COLORCYAN;
MH:=IF(MACD<0,-MACD,0);
ML:=IF(MACD>0,-MACD,0);
JJH:=IF(REF(JJ,1)>JJ,REF(JJ,1),JJ);
JJL:=IF(REF(JJ,1)<JJ,REF(JJ,1),JJ);
Z1:=IF(JJH>ML AND JJH<MH,JJH,IF(JJH>=MH,MH,DRAWNULL));
Z2:=IF(JJL>ML AND JJL<MH,JJL,IF(JJL<=ML,ML,DRAWNULL));
STICKLINE(0=0,YY+Z1,YY+Z2,0.1,0),COLORBLUE;
DRAWTEXT(CURRBARSCOUNT=16 AND BACKSET(C>BB5,CURRBARSCOUNT)=1 AND BACKSET(CROSS(MA1,BBI)=1,CURRBARSCOUNT)=1,IF(CC>MM,LL,HH),'收BB5上,上穿BBI'),COLORRED;
DRAWICON(CROSS(DIF,DEA), YY-MMM,1);
DRAWICON(CROSS(DEA,DIF), YY+MMM,2);
RSV:=(CLOSE - LLV(LOW,18))/(HHV(HIGH,18) - LLV(LOW,18))*100;
K:=EMA(RSV,3);
D:=EMA(K,3);
J:=(3*K-2*D);
kdj1:=REF(COUNT(J<REF(J,1),5)>=3,1) AND REF(J,1)<20;
kdJ2:=J>REF(J,1);
反转:=IF(FILTER(KDJ1 AND KDJ2,3),50,0),COLORRED;
VAR22:=REF(LOW,1);
VAR33:=SMA(Abs(LOW-VAR22),3,1)/SMA(MAX(LOW-VAR22,0),3,1)*100;
VAR44:=EMA(IF(CLOSE*1.3,VAR33*10,VAR33/10),3);
VAR55:=LLV(LOW,13);
VAR66:=HHV(VAR44,13);
VAR77:=IF(MA(CLOSE,34),1,0);
VAR888:=EMA(IF(LOW<=VAR55,(VAR44+VAR66*2)/2,0),3)/618*VAR77;
VAR999:=IF(VAR888>100,100,VAR888);
吸筹:=VAR999,LINETHICK1,COLORCD7F32 ;
HHZ:=CONST(HHV(C,120))*1;
LLZ:=CONST(LLV(C,120))*1;
HL:=CONST(IF(CONST((HHZ+LLZ)/2)<CONST(C),LLZ-(HHZ-LLZ)*0.4,HHZ+(HHZ-LLZ)*0.4));
HH1:=IF(CONST((HHZ+LLZ)/2)>CONST(C),HHZ,HL);
LL1:=IF(CONST((HHZ+LLZ)/2)<CONST(C),LLZ,HL);
HLMAX:=MAX(HH1,LL1);
HLMIN:=MIN(HH1,LL1);
HLMN1:=(HLMAX+HLMIN)/2;
HLMN2:=HLMAX-HLMIN;
HLMN3:=(100-0)/2;
HLMN4:=100-0;
(50-50)*HLMN2/100+HLMN1,COLOR555555;
(20-50)*HLMN2/100+HLMN1,COLOR555555;
(80-50)*HLMN2/100+HLMN1,COLOR555555;
(100-50)*HLMN2/100+HLMN1,COLOR555555;
STICKLINE(吸筹,(0-50)*HLMN2/100+HLMN1,
(VAR999-50)*HLMN2/100+HLMN1,2,10),COLORFF00FF;
STICKLINE(J<=0,(90-50)*HLMN2/100+HLMN1,
(100-50)*HLMN2/100+HLMN1,4,0),COLORYELLOW;
IF(反转=50,(50-50)*HLMN2/100+HLMN1,
(0-50)*HLMN2/100+HLMN1),COLORRED;
KZ:(K-50)*HLMN2/100+HLMN1,COLORFFFFFF;
DZ:(D-50)*HLMN2/100+HLMN1,COLOR00FFFF;
JZ:(J-50)*HLMN2/100+HLMN1,COLOR00FF00;
{ _通达信股票指标公式}
VL:=REF(LOW,1);
VAR12Z:=(SMA(ABS(LOW-VL),13,1))/(SMA(MAX(LOW-VL,0),13,1))*100;
VAR14Z:=MA(VAR12Z,13);
VAR15Z:=LLV(LOW,34);
VAR18Z:=EMA(IF(LOW<=VAR15Z,VAR14Z,0),3);
VAR110:=SMA(SMA((CLOSE-LLV(LOW,54))/(HHV(HIGH,54)-LLV(LOW,54))*100,7,1),5,1);
VAR111:=SMA((CLOSE-LLV(LOW,54))/(HHV(HIGH,54)-LLV(LOW,54))*100,7,1)*16.18-VAR110*10.9;
T:=FILTER(IF(VAR111<=VAR110 AND VAR18Z>REF(VAR18Z,1),VAR18Z*8,0),20);
DRAWTEXT(T,LOW-0.4,'←洗盘结束'),COLORFF00FF;
DRAWTEXT(T,LOW-0.2,'★'),COLORFF00FF;
VAR21:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36))*100;
VAR22X:=SMA(VAR21,3,1);
VAR23:=SMA(VAR22X,3,1);
VAR24:=SMA(VAR23,3,1);
VAR25:=CROSS(VAR23,VAR24) AND VAR23<20;
DRAWTEXT(FILTER(VAR25,10)=1,LOW-0.4,'←抄底'),COLORRED;
DRAWTEXT(FILTER(VAR25,10)=1,LOW-0.2,'★'),COLORRED;
VAR29:=CROSS(VAR24,VAR23) AND VAR23>80;
DRAWTEXT(FILTER(VAR29,5)=1,HIGH+0.4,'←逃顶');
DRAWTEXT(FILTER(VAR29,5)=1,HIGH+0.2,'★');
DIFZ:=EMA(C,12)-EMA(C,26);
DEAZ:=EMA(DIFZ,9);
MACDZ:=8*(DIFZ-DEAZ);
TYNNN:=60;
A1:=REF(HIGH,TYNNN)=HHV(HIGH,2*TYNNN+1); B1:=FILTER(A1,TYNNN);
C1:=BACKSET(B1,TYNNN+1); D1:=FILTER(C1,TYNNN);
A2:=REF(LOW,TYNNN)=LLV(LOW,2*TYNNN+1); B2:=FILTER(A2,TYNNN);
C2:=BACKSET(B2,TYNNN+1); D2:=FILTER(C2,TYNNN);
E1:=(REF(LLV(LOW,2*TYNNN),1)+REF(HHV(HIGH,2*TYNNN),1))/2; E2:=(HIGH+LOW)/2;
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
L1:=(D2 AND NOT(D1 AND E1<E2));
X1:=REF(BArslAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
RCC:=REF(L,BARSLAST(VV));
DRAWBAND(DIFZ*4+RCC,RGB(155,50,50),EMA(DIFZ*4+RCC,9),RGB(0,50,150));
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1),RCC,RCC+MACDZ,1,0),COLOR400080;
STICKLINE((RCC+MACDZ)>RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1),RCC,RCC+MACDZ,1,0),COLOR00FFFF;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)<=REF(RCC+MACDZ,1),RCC,RCC+MACDZ,1,0),COLOR008080;
STICKLINE((RCC+MACDZ)<=RCC AND (RCC+MACDZ)>REF(RCC+MACDZ,1),RCC,RCC+MACDZ,1,0),COLORC080FF;
IF(C,EMA(DIFZ*4+RCC,9),DRAWNULL),COLORFFFFFF,LINETHICK1;
IF(C,DIFZ*4+RCC,DRAWNULL),COLORRED,LINETHICK1;
IF(DIFZ<=REF(DIFZ,1),DIFZ*4+RCC,DRAWNULL),COLORFFF000;
JJV:=(H+L+C)/3;
QJ0:=vol/IF(H=L,4,H-L);
QJ1:=IF(CAPITAL=0,QJ0*(JJV-MIN(C,O)),QJ0*(MIN(O,C)-L));
QJ2:=IF(CAPITAL=0,QJ0*(MIN(O,C)-L),QJ0*(JJV-MIN(C,O)));
QJ3:=QJ0*(H-MAX(O,C));
QJ4:=QJ0*(MAX(C,O)-JJV);
QJ5:=QJ1+QJ2;
QJ6:=QJ3+QJ4;
DD:=(QJ5-QJ6)/(QJ5+QJ6)*100;
ddx:=((QJ1+QJ2)-(QJ3+QJ4))/SUM(VOL,10)*100;
DDZ:=DD*17;
DDY:=((QJ2+QJ4)-(QJ1+QJ3))/SUM(VOL,10)*100;
BB:=(CROSS(J,0)AND ((DDX>0 AND DDY>0) OR DDZ>400));
DRAWTEXT(BB,L*0.98,'★斋主赚点钱玩'),COLOR00FFFF;
MA18:=MA(CLOSE,18);
mtm:=C-REF(C,1);
DX1:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
买:=LLV(DX1,2)=LLV(DX1,7) AND COUNT(DX1<0,2) AND CROSS(DX1,MA(DX1,2));
DRAWTEXT(FILTER(买=1,5),LOW,'★买一'),COLORRED;
加1:=MA18>=REF(MA18,3) AND CROSS(CLOSE,MA18);
DRAWTEXT(加1,LOW*0.99,'★加一'),COLORCC66FF;
卖一:=HHV(DX1,2)=HHV(DX1,7) AND COUNT(DX1>50,2) AND CROSS(MA(DX1,2),DX1);
DRAWTEXT(FILTER(卖一=1,1),HIGH*1.01,'★卖一'),COLORGREEN;
AA1:=MA(C,5);
BB1:=MA(C,15);
AF:=CROSS(AA1,BB1);
STICKLINE(AF,LLV(L,4),LLV(L,4),80,1),COLORRED,LINETHICK3;
DRAWTEXT(AF,LLV(L,4),'止损 启动线'),COLORYELLOW;
VAR1:=VOL*(OPEN+CLOSE)/2;
搏杀生命线:SUM(VAR1,88)/SUM(VOL,88),LINETHICK3,COLORYELLOW;