A100:=0;
B200:=0;
C300:=0;
D400:=0;
EMA13:MA(C,13),COLORYELLOW,LINETHICK2;
EMA34:MA(C,34),COLORGREEN;
EMA55:MA(C,55),COLORRED;
{101红杏出墙}
HX1:=EMA13<EMA34 AND EMA34<EMA55;{股价长期下跌,并且远离长期均线}
HX2:=BARSLAST((C-EMA13)/EMA13*100<-6);{收盘价在13均线%6到现在的天数}
HX3:=ABS(1-EMA55/REF(C,1))>0.1;
HX6:=BARSLAST(CROSS(EMA55,EMA34))>=20;{13日均线下降趋于走平}
HX4:=ABS(1-REF(EMA13,1)/EMA13)<0.004 AND C<EMA34;
HX5:=REF(C,1)<EMA13 AND C>EMA13 AND C>O;
HX7:=HX1 {AND HX3} AND HX4 AND HX5 ;
HX8:=HX7 AND FILTER(HX7,10);{满足后10天内不标记}
红杏出墙:=HX8;
DRAWTEXT(红杏出墙,L*0.98,'101红杏出墙'),COLORYELLOW;
A101:红杏出墙*A100,COLORYELLOW,NODRAW;
{102蚂蚁上树}
BR1:=COUNT(BETWEEN(((C-O)/O)*100,0,5) ,5)=5;{5日内收盘价都比前日收盘价高}
BR2:=(ABS(EMA13-EMA34)+ABS(EMA34-EMA55))/C<0.1;{主均线相距很近或基本持平}
BR3:=C>EMA55 AND COUNT(L<EMA55,5)>=1;{股价送上55日均线}
MYSS:=BR1 AND BR2 AND BR3;
蚂蚁上树:=MYSS AND FILTER(MYSS,5);
DRAWTEXT(蚂蚁上树,L*0.99,'102蚂蚁上树'),COLORYELLOW;
A102:蚂蚁上树*A100,COLORYELLOW,NODRAW;
{103马失前蹄}
MSQT1:=EMA55/EMA13>1.04 AND EMA13/C>1.03;
MSQT2:=O<=REF(L,1) AND REF(O,1)/REF(C,1)>1.03;
MSQT:= MSQT1 AND MSQT2;
DRAWTEXT(MSQT,L*0.98,'103'),COLORYELLOW;
{104绝处逢生}
JCFS1:=EMA55>EMA13 AND EMA13>C;
JCFS2:=O<=REF(L,1) AND C/O>1.05;
JCFS:= JCFS1 AND JCFS2;
DRAWTEXT(JCFS,L*0.98,'104'),COLORYELLOW;
{105金屋藏娇}
JWCJ1:=C<O AND REF(C,1)<REF(O,1);
JWCJ2:=O<=REF(C,1) AND L>=REF(L,1);
JWCJ3:=REF(C,1)/REF(L,1)>1.02;
JWCJ4:=EMA13<EMA34 OR EMA13<EMA55;
JWCJ:=JWCJ1 AND JWCJ2 AND JWCJ3 AND JWCJ4;
DRAWTEXT(JWCJ,L*0.98,'105'),COLORYELLOW;
{106日月合璧}
RYHB1:=REF(O,1)<=REF(C,2) AND REF(C,1)<REF(O,1) AND ABS(1-REF(C,1)/REF(L,1))<0.02;
RYHB2:=C>O AND ABS(1-C/REF(O,1))<0.025 AND ABS(1-O/REF(C,1))<0.025;
RYHB3:=EMA13<REF(EMA13,1) OR ABS(1-EMA13/REF(EMA13,1))<0.01 AND (EMA13<EMA34 OR EMA13<EMA55);
RYHB4:=REF(L,1)<=LLV(REF(L,1),10);
RYHB:=RYHB1 AND RYHB2 AND RYHB3 AND RYHB4;
DRAWTEXT(RYHB,L*0.98,'106'),COLORYELLOW;
{107破镜重圆}
PJCY1:=REF(O,1)/REF(C,1)>1.02;
PJCY2:=O<=REF(C,1) AND C>=REF(O,1);
PJCY3:=(ABS(1-REF(C,1)/EMA55)<0.05 OR ABS(1-C/EMA55)<0.05 OR ABS(1-MA(C,2)/EMA55)<0.05);
PJCY4:=EMA13>EMA55 OR EMA13>MA(EMA13,5);
PJCY:=PJCY1 AND PJCY2 AND PJCY3 AND PJCY4;
DRAWTEXT(PJCY,L*0.98,'107'),COLORYELLOW;
{108步步高}
BBG1:=C>=REF(C,1) AND REF(C,1)>=REF(C,2);{3日内收盘价都比前日收盘价高}
BBG2:=V>=REF(V,1) AND REF(V,1)>=REF(V,2);{3日内量都比前日量高}
BBG3:=COUNT(C>=O,3)=3;
BBG:=BBG1 AND BBG2 AND BBG3;
DRAWTEXT(BBG AND FILTER(BBG,3),L*0.98,'108'),COLORYELLOW;
{201黑客点击}
DJ1:=EMA13>EMA34 AND EMA34<EMA55;{13日均线大于34日均线,34日均线小于55日均线}
DJ2:=O>EMA55;{开盘价大于55日均线}
DJ3:=CROSS(EMA13,EMA55) OR ABS(1-EMA13/EMA55)<0.002;
DJ4:=O>C AND C<REF(C,1);
HKDJ:= DJ2 AND DJ3 AND DJ4;
DRAWTEXT(HKDJ AND FILTER(HKDJ,10),L*0.97,'201'),COLORRED;
{202红衣侠女}
XN1:=ABS(1-HHV(EMA55,5)/LLV(EMA55,5))<0.02;
XN2:=CROSS(EMA13,EMA55) OR ABS(1-EMA13/EMA55)<0.002;
XN3:=C>O AND V>REF(V,1) AND C>EMA55;
HYXN:=XN1 AND XN2 AND XN3;
DRAWTEXT(HYXN AND FILTER(HYXN,5),L*0.993,'202红衣侠女'),COLORRED;
{203海底捞月}
LY1:=COUNT(ABS(1-EMA55/EMA34)<0.1,20)>=16;
LY2:=COUNT(CROSS(EMA34,EMA13),40)>=1 AND COUNT(CROSS(EMA55,EMA13),40)>=1;
LY3:=CROSS(EMA13,EMA55);
HDLY:=LY1 AND LY2 AND LY3;
DRAWTEXT(HDLY AND FILTER(HDLY,5),L*0.97,'203'),COLORRED;
{204均线互换}
JXHH:=BARSLAST(REF(CROSS(EMA55,EMA34),1)) AND CROSS(EMA34,EMA55);
DRAWTEXT(JXHH,L,'204均线互换'),COLORRED;
{205梅开二度}
MKED1:=BARSLAST(REF(CROSS(EMA34,EMA13),1));
MKED2:=COUNT(H>=EMA55,MKED1)=MKED1;
MKED:=MKED2 AND CROSS(EMA13,EMA34);
DRAWTEXT(MKED,L,'205梅开二度'),COLORRED;
{206一阳三线}
YY1:=C>EMA13 AND O<EMA13;
YY2:=C>EMA34 AND O<EMA34;
YY3:=C>EMA55 AND O<EMA55;
YYSX:=YY1 AND YY2 AND YY3;
DRAWTEXT(YYSX,L*0.97,'206'),COLORRED;
{207揭竿而起}
MAX3:=MAX(MAX(EMA13,EMA34),EMA55);
MIN3:=MIN(MIN(EMA13,EMA34),EMA55);
JG1:=ABS(EMA13-EMA34)<C*0.05;{13线34线55线接近}
JG2:=ABS(EMA34-EMA55)<C*0.05;
JG3:=C>=O*1.03 AND C>MAX3;{阳线3%}
JG4:=O>MIN3 AND O<MAX3;
JG5:=C>REF(H,5);
JG6:=(C-EMA34)/EMA34<=0.15;{控制价高}
JG7:=V>MA(V,5) AND MA(V,10);
JGEQ:=JG1 AND JG2 AND JG3 AND JG4 AND JG5 AND JG6 AND JG7;
DRAWTEXT(JGEQ,L,'207揭竿而起'),COLORRED;
{208三线推进}
MAX4:=MAX(MAX(MAX(EMA13,EMA34),EMA55),H);
MIN4:=MIN(MIN(MIN(EMA13,EMA34),EMA55),L);
SXTJ1:=HHV(MAX4,60);
SXTJ2:=LLV(MIN4,60);
SXTJ3:=EVERY(ABS(1-SXTJ1/SXTJ2)<0.3,20);
SXTJ:=SXTJ3 AND (YYSX OR JGEQ);
DRAWTEXT(SXTJ AND FILTER(SXTJ,10),L*0.97,'208三线推进'),COLORRED;
{209双蹄并进}
STBJ1:=CROSS(DMI.PDI,DMI.MDI);
STBJ2:=ABS(1-DMI.ADX/DMI.ADXR)<0.1;
STBJ:=STBJ1 AND STBJ2;
DRAWTEXT(STBJ,L*0.97,'209'),COLORRED;
{210投石问路}
TSWL1:=CROSS(EMA13,EMA34) AND EMA13<EMA55;
DRAWTEXT(TSWL1,L*0.97,'210'),COLORRED;
{211三军集结}
SJJJ3:=REF(EMA55,1)>REF(EMA13,1);
SJJJ4:=ABS(1-(MAX(MAX(EMA34,EMA55),EMA13)/MIN(MIN(EMA13,EMA34),EMA55)))<0.005;
SJJJ:=SJJJ3 AND SJJJ4;
DRAWTEXT(SJJJ AND FILTER(SJJJ,5),L,'211三军集结'),COLORRED;
{301浪子回头}
LZ1:=REF(C,2)<REF(O,2) AND REF(C,1)<REF(O,1) AND C<O;
LZ2:=C<=REF(C,1) AND REF(C,1)<=REF(C,2);
LZ3:=MA(V,3)<REF(V,3);
LZ4:=REF(C,3)>EMA13 AND (C>EMA55 OR ABS(1-C/EMA55)<0.01);
LZHT:=LZ1 AND LZ2 AND LZ3 AND LZ4;
DRAWTEXT(LZHT AND FILTER(LZHT,5), H*1.01,'301'),COLORBLUE;
{302走四方}
ZSF1:=REF(C,4)>REF(O,4) AND (REF(C,4)>EMA13 OR REF(C,4)>EMA34) AND (ABS(1-REF(EMA55,4)/EMA55)<0.01 OR MA(EMA55,4)>REF(EMA55,5));
ZSF2:=COUNT(ABS((1-REF(C,1)/C)*100)<3,4)=4 AND MA(V,4)<REF(V,4)*0.8;
ZSF:=ZSF1 AND ZSF2;
DRAWTEXT(ZSF AND FILTER(ZSF,4),H*1.01,'302'),COLORBLUE;
{303暗度陈仓}
ADCC1:=O/C>1.05 AND EMA13/EMA55<1.1 AND EMA13>MA(EMA13,5);
ADCC2:=O/REF(C,1)<1.03;{V<HHV(REF(V,1),5) AND V/MA(REF(V,1),5)<2};
ADCC:=ADCC1 AND ADCC2;
DRAWTEXT(ADCC,H*1.01,'303'),COLORBLUE;
{304一石二鸟}
YSEN1:=REF(C,2)>REF(O,2) AND REF(C,1)<REF(O,1) AND C<O;
YSEN2:=REF(C,2)>EMA55 AND EMA13>EMA55 AND EMA13>=MA(EMA13,5);
YSEN3:=REF(V,2)>REF(V,1) AND REF(V,2)>V;
YSEN:=YSEN1 AND YSEN2 AND YSEN3;
DRAWTEXT(YSEN,H*1.01,'304'),COLORBLUE;
{305双飞燕}
SFY1:=EMA13>EMA34 AND EMA34>EMA55;
SFY2:=REF(O,1)>=REF(C,2) AND O>=REF(C,1) AND REF(C,2)>=REF(O,2);
SFY3:=COUNT(C>O AND C/O<1.02,2)=2 OR COUNT(C<O AND O/C<1.02,2)=2;
SFY4:= V<REF(V,1);
SFY:=SFY1 AND SFY2 AND SFY3 AND SFY4;
DRAWTEXT(SFY AND FILTER(SFY,2),H*1.01,'305'),COLORBLUE;
{306三剑客}
SJK1:=EMA13>EMA34 AND EMA34>EMA55;
SJK2:=COUNT(C<=O AND O/C<1.03,3)=3 AND COUNT(ABS(1-REF(C,1)/C)<1.03,2)=2;
SJK:=SJK1 AND SJK2;
DRAWTEXT(SJK AND FILTER(SJK,3),H*1.01,'306'),COLORBLUE;
{307四星望月}
SXWY1:=COUNT(C>=O AND C/O<1.03,4)=4;
SXWY2:=(ABS(EMA13-EMA34)+ABS(EMA34-EMA55))/C<0.1;{主均线相距很近或基本持平}
SXWY3:=EMA13<EMA55;
SXWY:=SXWY1 AND SXWY2 AND SXWY3;
DRAWTEXT(SXWY AND FILTER(SXWY,5),H*1.01,'307'),COLORBLUE;
{308星星点灯}
XXDD1:=ABS(1-C/O)*100<=2.5 AND H/MAX(C,O)>1.03 AND REF(C,1)/REF(O,1)>1.05;
XXDD2:=O>=REF(C,1) AND ABS(1-REF(EMA13,1)/EMA55)<0.1;
XXDD:=XXDD1 AND XXDD2;
DRAWTEXT(XXDD,H*1.01,'308'),COLORBLUE;
{309小鸟依人}
XNYR1:=REF(C,1)/REF(O,1)>1.05;
XNYR2:=O<=REF(C,1) AND ABS(1-C/O)<0.02;
XNYR3:=COUNT(JGEQ OR YYSX OR HYXN,10)>=1 AND COUNT(JGEQ OR YYSX OR HYXN,2)=0;
XNYR:=XNYR1 AND XNYR2 AND XNYR3;
DRAWTEXT(XNYR,H*1.01,'309'),COLORBLUE;
{310立竿见影}
LGJY1:=O<=REF(C,1) AND V<REF(V,1) AND C<O;
LGJY2:=COUNT(JGEQ OR YYSX OR HYXN,2)=1;
LGJY:=LGJY1 AND LGJY2;
DRAWTEXT(LGJY,H*1.01,'310'),COLORBLUE;
{401一阴三线}
YYSX1:=C<EMA13 AND O>EMA13;{一阴三线}
YYSX2:=C<EMA34 AND O>EMA34;
YYSX3:=C<EMA55 AND O>EMA55;
YYYSX:=YYSX1 AND YYSX2 AND YYSX3;
DRAWTEXT(YYYSX,H,'401'),COLORGREEN;
{402落井下石}
LJXS1:=O<REF(L,1) AND EMA13/EMA55>1.05 AND C<O;
DRAWTEXT(LJXS1,H,'402'),COLORGREEN;
{403晨钟暮鼓}
CZMG1:=REF(C,1)/REF(O,1)>1.05 AND REF(V,1)/REF(V,2)>2 AND HSL>3;
CZMG2:=C>O AND V<REF(V,1);
CZMG:=CZMG1 AND CZMG2;
DRAWTEXT(CZMG,H,'403晨钟暮鼓'),COLORGREEN;
{404见好就收}
Y:=(EMA13-EMA55)/EMA13*100;
JHJX:=REF(Y,1)<=10 AND Y>10;
{DRAWICON(JHJX,H,1);}
DRAWTEXT(JHJX,H,'404'),COLORGREEN;
{405一枝独秀}
YZ1:=C/O>1.01 AND H/C>1.025 ;{收阳有上影}
YZ2:=EMA13>MAX(EMA34,EMA55) AND C>1.05*EMA13 AND O>MA(C,11);{昨收阳 今大于均线}
YZDX:=YZ1 AND YZ2;
DRAWTEXT(YZDX,H,'405一枝独秀'),COLORGREEN;
{406独上高楼}
DSGL1:=REF(C,1)>=REF(O,1);
DSGL2:=O/REF(C,1)>1.029 AND O/C>1.03 AND O/MAX(EMA13,EMA55)>1.03;
DSGL:=DSGL1 AND DSGL2;
DRAWTEXT(DSGL,H,'406独上高楼'),COLORGREEN;
{407分道扬镳}
FDYB:=CROSS(EMA34,EMA13) AND EMA34>EMA55;
DRAWTEXT(FDYB,H*1.01,'407分道扬镳'),COLORGREEN;
{408突出重围}
TCCW1:=REF(EMA55,1)<REF(EMA13,1);
TCCW2:=EMA13<LLV(REF(EMA13,1),5) AND ABS(1-(MAX(MAX(EMA34,EMA55),EMA13)/MIN(MIN(EMA13,EMA34),EMA55)))<0.008;
TCCW:=TCCW1 AND TCCW2;
DRAWTEXT(TCCW AND FILTER(TCCW,5),H,'408'),COLORGREEN;
{409明修栈道}
MXZD1:=C/O>1.07;
MXZD2:=EMA13>HHV(REF(EMA13,1),5) AND V>HHV(REF(V,1),10) AND V/MA(REF(V,1),5)>2;
MXZD:=MXZD1 AND MXZD2;
DRAWTEXT(MXZD,H,'409'),COLORGREEN;
{410拖泥带水}
TNDS1:=O/REF(C,1)>1.05 AND MIN(C,O)/L>1.03;
TNDS2:=C/MAX(EMA13,EMA55)>1.03 AND C>REF(C,1);
TNDS:=TNDS1 AND TNDS2;
DRAWTEXT(TNDS,H,'410'),COLORGREEN;
{411金蝉脱壳}
JCTQ1:=C<O AND (EMA13/EMA55>1.1 OR (C/MIN(EMA13,EMA55)>1.1)) AND EMA13>MA(EMA13,5);
JCTQ2:=REF(O,1)>=REF(C,2) AND REF(C,1)>REF(O,1) AND O<=REF(C,1) AND C>REF(O,1);
JCTQ:=JCTQ1 AND JCTQ2;
DRAWTEXT(JCTQ,H,'411'),COLORGREEN;
{412一箭穿心}
YJCX:=CROSS(EMA55,EMA13);
DRAWTEXT(YJCX,H,'412'),COLORGREEN;
{413过河拆桥}
GHCQ1:=C<O AND O/C>=1.04;
GHCQ2:=O>EMA13 AND C<EMA13;
GHCQ3:=EMA13/EMA55>1.1 AND ABS(1-EMA13/MA(EMA13,3))<0.02;
GHCQ:=GHCQ1 AND GHCQ2 AND GHCQ3;
DRAWTEXT(GHCQ,H,'413'),COLORGREEN;
{414狗急跳墙}
GJTQ1:=O/REF(C,1)>1.02 AND L>REF(C,1);
GJTQ2:=V>MA(V,5);
GJTQ3:=EMA13/EMA55>1.1;
GJTQ:=GJTQ1 AND GJTQ2 AND GJTQ3;
DRAWTEXT(GJTQ,H,'414'),COLORGREEN;
{415一剑封喉}
YJFH1:=REF(C,1)>=REF(O,1);
YJFH2:=H/MAX(C,O)>=1.035 ;
YJFH3:=V/MA(REF(V,1),11)>3 AND EMA13/EMA55>1.05;
YJFH:=YJFH1 AND YJFH2 AND YJFH3;
DRAWTEXT(YJFH,H,'415'),COLORGREEN;
{416节外生枝}
JWSZ1:=EMA13>MAX(EMA34,EMA55) AND EMA13/EMA55>1.1 AND REF(C,1)>1.04*EMA13 AND REF(C,1)/REF(O,1)>1.04;
JWSZ2:=ABS(1-C/O)<0.015 AND ABS(1-REF(C,1)/C)<0.02;
JWSZ:=JWSZ1 AND JWSZ2;
DRAWTEXT(JWSZ,H,'416'),COLORGREEN;
{417笑里藏刀}
XLCD1:=REF(H,1)/MAX(REF(C,1),REF(O,1))>1.04;
XLCD2:=H<REF(H,1) AND O>=REF(C,1);
XLCD3:=EMA13/EMA55>1.05 AND C/EMA13>1.03;
XLCD:=XLCD1 AND XLCD2 AND XLCD3;
DRAWTEXT(XLCD,H,'417'),COLORGREEN;
DRAWTEXT_FIX(1,0.01,0.01,0,'黄 101红杏出墙 102蚂蚁上树 103马失前蹄 104绝处逢生'),COLORYELLOW;
DRAWTEXT_FIX(1,0.01,0.04,0,'黄 105金屋藏娇 106日月合壁 107破镜重圆 108步步高'),COLORYELLOW;
DRAWTEXT_FIX(1,0.01,0.10,0,'红 201黑客点击 202红衣侠女 203海底捞月 204均线互换'),COLORRED;
DRAWTEXT_FIX(1,0.01,0.13,0,'红 205梅开二度 206益阳三线 207揭竿而起 208三线推进'),COLORRED;
DRAWTEXT_FIX(1,0.01,0.16,0,'红 209双蹄并进 210投石问路 211三军集结'),COLORRED;
DRAWTEXT_FIX(1,0.3,0.01,0,'蓝 301浪子回头 302走四方 303暗度陈仓 304一石二鸟'),COLORBLUE;
DRAWTEXT_FIX(1,0.3,0.04,0,'蓝 305双飞燕 306三剑客 307四星望月 308星星点灯'),COLORBLUE;
DRAWTEXT_FIX(1,0.3,0.07,0,'蓝 309小鸟依人 310立竿见影'),COLORBLUE;
DRAWTEXT_FIX(1,0.6,0.01,0,'绿 401一阴三线 402落井下石 403晨钟暮鼓 404见好就收'),COLORGREEN;
DRAWTEXT_FIX(1,0.6,0.04,0,'绿 405一枝独秀 406独上高楼 407分道扬镳 408突破重围'),COLORGREEN;
DRAWTEXT_FIX(1,0.6,0.07,0,'绿 409明修饯道 410拖泥带水 411金蝉脱壳 412一箭穿心'),COLORGREEN;
DRAWTEXT_FIX(1,0.6,0.11,0,'绿 413过河拆桥 414狗急跳墙 415一剑封喉 416节外生枝 417笑里藏刀'),COLORGREEN;