V2D:=IF(V24,COUNT(VB,(REF(BARSLAST(V24),1) + 1)),0);
V2E:=IF(((V2D = 1) AND V24),BARSLAST(V28),0);
V2F:=IF((V24 AND (REF(HIGH,BARSLAST(V28)) <= REF(HIGH,BARSLAST(V2A)))),BARSLAST(V2A),BARSLAST(V28));
V30:=IF(((V2D = 2) AND V24),V2F,0);
V3B:=IF(((V2D >= 3) AND V24),IF((V24 AND (REF(HIGH,V2F) <= REF(HIGH,BARSLAST(V2C)))),BARSLAST(V2C),V2F),0);
V3C:=((V2E + V30) + V3B);
V3D:=BACKSET(V24,V3C);
V3E:=(V3D > REF(V3D,1));
AA:=BACKSET(V3E,2);
AAA:=(AA > REF(AA,1));
BB:=BACKSET(V7,(BARSLAST(AAA) + 1));
CC1:=(BB > REF(BB,1));
CC:=BACKSET(CC1,(REF(BARSLAST(AAA),1) + 2));
AAA2:=(CC > REF(CC,1));
DRAWLINE(K=1 AND AAA2,HIGH,K=1 AND CC1,HIGH,1),POINTDOT,color00AAAA;
BB2:=(REF(HIGH,4) = HHV(HIGH,((2 * 4) + 1)));
CC22:=FILTER(BB2,4);
CC2:=BACKSET(CC22,(4 + 1));
EA:=FILTER(CC2,4);
EB:=(EA OR BARSTATUS=2);
A6:=(REF(LOW,4) = LLV(LOW,((2 * 4) + 1)));
EE:=FILTER(A6,4);
FF1:=BACKSET(EE,(4 + 1));
EE2:=FILTER(FF1,4);
FF2:=(EE2 AND NOT(EA));
EE3:=BACKSET(EB,(REF(BARSLAST(FF2),1) + 1));
FF3:=(EE3 > REF(EE3,1));
JS:=BACKSET(FF3,2);
G1:=(JS > REF(JS,1));
GA:=BACKSET((G1 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
G2:=(GA > REF(GA,1));
G3:=BACKSET((G2 AND (COUNT(EB,(REF(BARSLAST(FF2),1) + 2)) = 0)),(REF(BARSLAST(FF2),1) + 2));
GG:=(G3 > REF(G3,1));
JA:=IF(EB,COUNT(FF2,(REF(BARSLAST(EB),1) + 1)),0);
JB:=IF(((JA = 1) AND EB),BARSLAST(G1),0);
JJ:=IF((EB AND (REF(LOW,BARSLAST(G1)) >= REF(LOW,BARSLAST(G2)))),BARSLAST(G2),BARSLAST(G1));
LD:=IF(((JA = 2) AND EB),JJ,0);
LD1:=IF(((JA >= 3) AND EB),IF((EB AND (REF(LOW,JJ) >= REF(LOW,BARSLAST(GG)))),BARSLAST(GG),JJ),0);
HEA:=((JB + LD) + LD1);
HEB:=BACKSET(EB,HEA);
HEE:=(HEB > REF(HEB,1));
HFF1:=BACKSET(HEE,2);
HEE2:=(HFF1 > REF(HFF1,1));
HFF2:=(HEE2 OR BARSTATUS=2);
HEE3:=BACKSET(HFF2,(REF(BARSLAST(EB),1) + 1));
HFF3:=(HEE3 > REF(HEE3,1));
HJS:=BACKSET(HFF3,2);
HG1:=(HJS > REF(HJS,1));
HGA:=BACKSET((HG1 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HG2:=(HGA > REF(HGA,1));
HG3:=BACKSET((HG2 AND (COUNT(HFF2,(REF(BARSLAST(EB),1) + 2)) = 0)),(REF(BARSLAST(EB),1) + 2));
HGG:=(HG3 > REF(HG3,1));
HJA:=IF(HFF2,COUNT(EA,(REF(BARSLAST(HFF2),1) + 1)),0);
HJB:=IF(((HJA = 1) AND HFF2),BARSLAST(HG1),0);
HJJ:=IF((HFF2 AND (REF(HIGH,BARSLAST(HG1)) <= REF(HIGH,BARSLAST(HG2)))),BARSLAST(HG2),BARSLAST(HG1));
HD:=IF(((HJA = 2) AND HFF2),HJJ,0);
X1:=IF(((HJA >= 3) AND HFF2),IF((HFF2 AND (REF(HIGH,HJJ) <= REF(HIGH,BARSLAST(HGG)))),BARSLAST(HGG),HJJ),0);
X2:=((HJB + HD) + X1);
Y1:=BACKSET(HFF2,X2);
Y2:=(Y1 > REF(Y1,1));
Z1:=BACKSET(Y2,2);
Z2:=(Z1 > REF(Z1,1));
UU:=BACKSET(BARSTATUS=2,(BARSLAST(HEE2) + 1));
VV:=(UU > REF(UU,1));
WW:=BACKSET(BARSTATUS=2,(BARSLAST(Z2) + 1));
XX:=(WW > REF(WW,1));
UU2:=IF((BARSLAST(VV) < BARSLAST(XX)),VV,XX);
VV2:=IF((BARSLAST(VV) < BARSLAST(XX)),LOW,HIGH);
DRAWLINE(K=1 AND UU2,VV2,K=1 AND BARSTATUS=2,CLOSE,0),POINTDOT,colorFF9900;
WW2:=BACKSET(BARSTATUS=2,(BARSLAST(HEE2) + 1));
XX2:=(WW2 > REF(WW2,1));
VAR246:=BACKSET(XX2,(REF(BARSLAST(HEE2),1) + 2));
VAR247:=(VAR246 > REF(VAR246,1));
DRAWLINE(K=1 AND VAR247,LOW, K=1 AND XX2,LOW,1),POINTDOT,color00ffff;
VAR249:=BACKSET(BARSTATUS=2,(BARSLAST(Z2) + 1));
VAR250:=(VAR249 > REF(VAR249,1));
VAR251:=BACKSET(VAR250,(REF(BARSLAST(Z2),1) + 2));
VAR252:=(VAR251 > REF(VAR251,1));
DRAWLINE(K=1 AND VAR252,HIGH, K=1 AND VAR250,HIGH,1),POINTDOT,color00ffff;
wN:=p1;{原码 N:=3;}
wA1:=REF(H,wN)=HHV(H,2*wN+1); wB1:=FILTER(wA1,wN); wC1:=BACKSET(wB1,wN+1); wD1:=FILTER(wC1,wN);{高点}
wA2:=REF(L,wN)=LLV(L,2*wN+1); wB2:=FILTER(wA2,wN); wC2:=BACKSET(wB2,wN+1); wD2:=FILTER(wC2,wN);{低点}
wE1:=(REF(LLV(L,2*wN),1)+REF(HHV(H,2*wN),1))/2; wE2:=(H+L)/2;{高低点出现在同一K线上时可作取舍}
wH1:=(wD1 AND NOT(wD2 AND wE1>=wE2)) OR DISPSTATUS=2 OR BARSCOUNT(C)=1;
wL1:=(wD2 AND NOT(wD1 AND wE1<wE2)); wH2:=wD1 AND NOT(wD2 AND wE1>=wE2);
wX1:=REF(BARSLAST(wH1),1)+1; wF1:=BACKSET(wH1 AND COUNT(wL1,wX1)>0,LLVBARS(IF(wL1,L,10000),wX1));
wG1:=wF1>REF(wF1,1); wI1:=BACKSET(wG1,2); wLD:=wI1>REF(wI1,1);{过滤后低点}
wL2:=wLD OR DISPSTATUS=2 OR BARSCOUNT(C)=1;
wX2:=REF(BARSLAST(wL2),1)+1; wF2:=BACKSET(wL2 AND COUNT(wH2,wX2)>0,HHVBARS(IF(wH2,H,0),wX2));
wG2:=wF2>REF(wF2,1); wI2:=BACKSET(wG2,2); wHD:=wI2>REF(wI2,1);{过滤后高点}
wR1:=BACKSET(DISPSTATUS=2,BARSLAST(wHD)+1); wS1:=wR1>REF(wR1,1); {前一高}
wT1:=BACKSET(DISPSTATUS=2,BARSLAST(wLD)+1); wU1:=wT1>REF(wT1,1); {前一低}
wR2:=BACKSET(wS1,REF(BARSLAST(wHD),1)+2); wS2:=wR2>REF(wR2,1); {前二高}
wT2:=BACKSET(wU1,REF(BARSLAST(wLD),1)+2); wU2:=wT2>REF(wT2,1); {前二低}
wT3:=BACKSET(wU2,REF(BARSLAST(wLD),1)+2); wU3:=wT3>REF(wT3,1); {前三低}
wT4:=BACKSET(wU3,REF(BARSLAST(wLD),1)+2); wU4:=wT4>REF(wT4,1); {前四低}
wR3:=BACKSET(wS2,REF(BARSLAST(wHD),1)+2); wS3:=wR3>REF(wR3,1); {前三高}
wR4:=BACKSET(wS3,REF(BARSLAST(wHD),1)+2); wS4:=wR4>REF(wR4,1); {前四高}
DRAWLINE(K=2 AND wS2,H,K=2 AND wS1,H,1),Color008888; {★压力1:}
DRAWLINE(K=2 AND wU2,L,K=2 AND wU1,L,1),POINTDOT,Color008888;{★支撑1:}
DRAWLINE(K=2 AND wS3,H,K=2 AND wS2,H,1),Color888000; {★压力2:}
DRAWLINE(K=2 AND wU3,L,K=2 AND wU2,L,1),POINTDOT,Color888000;{★支撑2:}
DRAWLINE(K=2 AND wS4,H,K=2 AND wS3,H,1),Color0000CC;{★压力3:}
DRAWLINE(K=2 AND wU4,L,K=2 AND wU3,L,1),POINTDOT,Color0000CC;{★支撑3:};
底:=SUM(MA(CLOSE,10),9)/11.114;
DRAWTEXT(CROSS(LOW,底) AND REF(底,1)>REF(HIGH,1) OR CROSS(HIGH,底),0.85*CLOSE,'---铁底'),color00FF00;
X1:=(3*CLOSE+HIGH+LOW+OPEN)/6;
X2:=EMA(X1,10);
X3:=REF(X2,1);
X4:=(REF(HIGH,1)+REF(LOW,1))/2;
X5:=MA(CLOSE,21)+2*STD(CLOSE,21);
X6:=REF(CLOSE,1);
X7:=(SMA(MAX(CLOSE-X6,0),7,1))/(SMA(ABS(CLOSE-X6),7,1))*100;
X8:=CROSS(79,X7);
X9:=FILTER(X8,4);
WZ1:=POW(MA(CLOSE,5),2)+MA(CLOSE,5);
WZ2:=POW(MA(LOW,5),2)+MA(LOW,5);
WZ3:=POW(MA(HIGH,5),2)+MA(HIGH,5);
WZ4:=(WZ1-LLV(WZ2,9))/(HHV(WZ3,9)-LLV(WZ2,9))*150+65;
DK:=SMA(WZ4,3,1)*1.5;
DD:=SMA(DK,3,1);
DJ:=3*DK-2*DD;
WZ5:=EMA(CLOSE,12)-EMA(CLOSE,26);
WZ6:=EMA(WZ5,9);
WZ7:=2*(WZ5-WZ6);
WZ8:=REF(WZ7,1);
WZ9:=CROSS(WZ8,WZ7) AND WZ8>0;
VAR1T:=EMA(CLOSE,8);
VAR2T:=EMA(VAR1T,20);
VAR3T:=CROSS(VAR1T,VAR2T);
VAR4T:=VAR1T<MA(CLOSE,120);
VAR5T:=(HHV(HIGH,36)-CLOSE)/(HHV(HIGH,36)-LLV(LOW,36))*100;
VAR6T:=SMA(VAR5T,5,1);
VAR7T:=SMA(VAR6T,8,1);
VAR8T:=CROSS(VAR6T,VAR7T) AND VAR7T<20;
VAR9T:=CLOSE>LLV(CLOSE,60)+0.3*LLV(CLOSE,60) AND VAR8T;
VARA:=IF(CLOSE>1000,VAR8T,VAR9T);
起步:=VAR3T AND VAR4T;
逃遁:=VARA;
XL1:=EMA(CLOSE,10)/100;
XL2:=MA((XL1-REF(XL1,10))/REF(XL1,10),3)*100;
XL3:=MA(XL2,3);
XL4:=SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1);
DRAWTEXT(IF(CROSS(3*XL4-2*SMA(XL4,3,1),8),87,0) AND X2>X3,LOW-0.1,'←反弹'),colorred;
DRAWTEXT(IF(CROSS((VAR1T-LLV(VAR1T,4))/(HHV(VAR1T,4)-LLV(VAR1T,4))*4*25,87.5) AND VAR1T<40,87,0) AND X2>X3,LOW-0.15,'←短买'),colorFFFF00;
DRAWTEXT(IF(CROSS(2*(EMA((CLOSE*2+HIGH+LOW)/4,12)-EMA((CLOSE*2+HIGH+LOW)/4,26)-(EMA(EMA((CLOSE*2+HIGH+LOW)/4,12)-EMA((CLOSE*2+HIGH+LOW)/4,26),2)))*5.8,0.47),LOW,0) AND X2>X3,LOW-0.2,'←加仓'),colorFF5ED8;
DRAWTEXT(CROSS(X4,X5),HIGH*1.01,'←减'),color00FF00;
DRAWTEXT(FILTER((WZ9 AND DJ>250) OR X9 ,5),HIGH*1.02,'←跑'),colorBCFF8B;
STICKLINE(起步>0,HIGH,LOW,0.8,0),color00FFFF;
STICKLINE(起步>0,OPEN,CLOSE,5,0),color00FFFF;
DRAWTEXT(逃遁>0,HIGH*1.04,'●←逃'),color7FFFD6;
sam:=(C+L+H)/3;
BB13:=ATAN(EMA(sam,13)-REF(EMA(sam,13),1))*3.1416*10;
EMA8:=EMA(C,8);
DRAWTEXT(FILTER(BB13>1 AND EMA(sam,13)>REF(EMA(sam,8),1),10),
EMA8,'∠45上升'),COLORWHITE;
VAR3aa:=IF((CLOSE>REF(CLOSE,1)),88,0);
VAR4aa:=IF(((CLOSE)/(REF(CLOSE,1))>1.05) AND ((HIGH)/(CLOSE)<1.01) AND (VAR3aa>0),91,0);
DRAWTEXT(FILTER((VAR4aa>90),45),(LOW)*(0.94999998),'★大胆搏 '),Color00FFFF;
L23:=MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20;
L24:=(HIGH+LOW+CLOSE)/3;
L25:=(L24-MA(L24,14))/(0.015*AVEDEV(L24,14));
L26:=(L24-MA(L24,70))/(0.015*AVEDEV(L24,70));
L27:=IF(L25>=150 AND L25<200 AND L26>=150 AND L26<200,10,0);
L28:=IF(L25<=-150 AND L25>-200 AND L26<=-150 AND L26>-200,-10,L27);
L29:=100-ABS((CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100);
L30:=IF(L29<90,L29,100);
L31:=IF(L23>0,L23,0);
XL1:=(IF(L28>=200 AND L25>=150,15,IF(L26<=-200 AND L25<=-150,-15,L28)))+60;
XL2:=L31>48 AND XL1>60 AND L30<100;
DRAWTEXT(XL2 AND COUNT(XL2,30)=1,l,'大笔成交'),colorFF00FF;
MTM:=C-REF(C,1);
DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6);
买:=IF(LLV(DX,2)=LLV(DX,7) AND COUNT(DX<0,2) AND CROSS(DX,MA(DX,2)),1,0);
DRAWTEXT(filter(买=1,5),LOW-0.3,'▲拉升'),Colormagenta;
{放量股价上穿布林中轨}
放量:=close>ma(close,24) and vol/ref(vol,1)>2;