抖音更新中的教程对应源码51-100
{第100讲过左峰副图及过滤公式编写方法}
波峰K线:=V=HHV(V,11) AND H=HHV(H,11) AND V>MA(V,120);
波峰以来时间:=BARSLAST(波峰K线);
未突破:=EVERY(H<REF(H,波峰以来时间),波峰以来时间);
XG:REF(未突破,1) AND C>REF(REF(H,波峰以来时间),1) AND 波峰以来时间>9;
{第99讲 MACD柱面积阶段统计的编写方法}
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
金叉:=CROSS(DIF,DEA);
死叉:=CROSS(DEA,DIF);
红柱数:IF(MACD>0,BARSLAST(金叉)+1,DRAWNULL),NODRAW;
蓝柱数:IF(MACD<0,BARSLAST(死叉)+1,DRAWNULL),NODRAW;
红面积:IF(MACD>0,SUM(MACD,红柱数),IF(死叉,REF(SUM(MACD,红柱数),1),DRAWNULL)),NODRAW;
蓝面积:IF(MACD<0,ABS(SUM(MACD,蓝柱数)),IF(金叉,ABS(REF(SUM(MACD,蓝柱数),1)),DRAWNULL)),NODRAW;
DRAWNUMBER((MACD>0 AND ISLASTBAR) OR 死叉,ABS(MACD),红面积),COLORRED,DRAWABOVE;
DRAWNUMBER((MACD<0 AND ISLASTBAR) OR 金叉,-ABS(MACD),蓝面积),COLORCYAN;
{第98讲在指标源码中设置有效期的编写方法}
形态条件:=CROSS(MA(CLOSE,5),MA(CLOSE,10));
时间条件:=DATE<=1240601;{20240601-19000000}
XG:形态条件 AND 时间条件;
{第97讲在指标中手工画柱状图的编写方法}
DRAWRECTREL(100,0,130,1000,RGB(255,255,0));
DRAWRECTREL(160,100,190,1000,RGB(255,0,0));
{第96讲} 某条件非连续出现三次的编写方法
阴线:=C<O;
二连阴:=EVERY(阴线,2);
三连阴:=EVERY(阴线,3);
XG:阴线 AND COUNT(阴线,15)=3 AND NOT(EXIST(二连阴,15)) AND NOT(EXIST(三连阴,15));
{第95讲缩量调整后一阳包三阴过滤公式编写方法}
缩量:=VOL<REF(VOL,1);
调整:=CLOSE<OPEN AND CLOSE<REF(CLOSE,1);
缩量调整:=EVERY(缩量,3) AND EVERY(调整,3);
阳包阴:=O<REF(C,1) AND C>REF(O,3);
XG:REF(缩量调整,1) AND 阳包阴;
{第94讲今天和昨天同时段成交额对比编写方法}
距开盘:=IF(TIME>=0930 AND TIME<=1130,(HOUR-9)*60+MINUTE-30,
IF(TIME>=1300 AND TIME<=1500,(HOUR-9-2)*60+MINUTE,DRAWNULL)),NODRAW;
分钟成交额:AMOUNT/100000000,VOLSTICK;
实时成交额:SUM(AMOUNT,距开盘+1)/100000000,NODRAW;
昨实时成交额:REF(实时成交额,240),NODRAW;
NOTEXT实时1:实时成交额/50,COLORYELLOW;
NOTEXT实时2:昨实时成交额/50,COLORMAGENTA;
{第93讲底量超顶量副图及过滤公式编写方法}
顶距今:=HHVBARS(H,144);
底距今:=LLVBARS(L,144);
顶量:=REF(V,顶距今);
底量:=REF(V,底距今);
XG:顶距今>底距今AND 底量>顶量 AND 底距今<=15;
{第92讲黄金分割线主图叠加源码编写方法}
高:=REF(HHV(H,80),3);
低:=REF(LLV(L,80),3);
H19:=高-(高-低)*0.191;
H38:=高-(高-低)*0.382;
H中:=高-(高-低)*0.5;
H61:=高-(高-低)*0.618;
H80:=高-(高-低)*0.809;
顶点:REFDATE(高,DATE),COLORWHITE;
%191:REFDATE(H19,DATE),COLORYELLOW;
%382:REFDATE(H38,DATE),COLORMAGENTA;
%500:REFDATE(H中,DATE),COLORRED;
%618:REFDATE(H61,DATE),COLORMAGENTA;
%809:REFDATE(H80,DATE),COLORYELLOW;
低点:REFDATE(低,DATE),COLORWHITE;
DRAWTEXT(ISLASTBAR,顶点,'顶点'),COLORWHITE;
DRAWTEXT(ISLASTBAR,%191,'%19.1'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,%382,'%38.2'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,%500,'%50.0'),COLORRED;
DRAWTEXT(ISLASTBAR,%618,'%61.8'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,%809,'%80.9'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,低点,'低点'),COLORWHITE;
{第91讲累积换手率过滤公式的编写方法}
换手率:100*V/CAPITAL,NODRAW;
累积换手率:SUM(换手率,66),COLORRED;
{第90讲 MACD海豚嘴过滤公式编写方法}
SHORT:=12;LONG:=26;MID:=9;
DIF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:=EMA(DIF,MID);
MACD:=(DIF-DEA)*2;
MACD金叉:=CROSS(DIF,DEA);
MACD金叉以来:=BARSLAST(MACD金叉);
红柱持续缩小:=EVERY(MACD<REF(MACD,1),4) AND EVERY(MACD>0,MACD金叉以来);
红柱放大:=MACD>REF(MACD,1);
条件组合:=红柱放大 AND REF(红柱持续缩小,1);
XG:EXIST(条件组合,2);
{第89讲放量突破整理平台过滤公式的编写方法}
五均量线:=MA(V,5);
量比:=V/REF(五均量线,1);
均线144:=MA(C,144);
平台高点:=HHV(H,144);
平台低点:=LLV(L,144);
上偏离:=(平台高点-均线144)/均线144;
下偏离:=(均线144-平台低点)/均线144;
整理:=REF(上偏离,1)<0.15 AND REF(下偏离,1)<0.15;
新高:=HHV(H,144);
突破:=H=新高;
条件:=量比>=2 AND 整理 AND 突破;
XG:EXIST(条件,3);
{第88讲希望预警出的股票属于指定板块的编写方法}
涨幅:=C/REF(C,1)>1.05;
{板块:=INBLOCK('元器件');}
板块:=FINDSTR(HYBLOCK,'元器件');
XG:涨幅 AND 板块;
{第87讲相邻N天股价重叠部分划线并标记价格的编写方法}
N:=5;
上边界:=LLV(H,N);
下边界:=HHV(L,N);
DRAWSL(ISLASTBAR=1 AND 上边界>下边界,下边界,0,N-1,1)COLORLIGRAY;
DRAWSL(ISLASTBAR=1 AND 上边界>下边界,上边界,0,N-1,1)COLORLIGRAY;
DRAWNUMBER(ISLASTBAR=1 AND 上边界>下边界,下边界,下边界)COLORYELLOW;
DRAWNUMBER(ISLASTBAR=1 AND 上边界>下边界,上边界,上边界)COLORYELLOW;
{第86讲即将收复跌停副图及过滤公式编写方法}
跌停:=C/REF(C,1)<0.9008;
跌停以来:=BARSLAST(跌停);
跌停以来>9 AND 跌停以来<33 AND C>REF(C,跌停以来)*1.06 AND
EVERY(H<REF(H,跌停以来),跌停以来);
{第85讲某条件倒数第N次出现距离现在的时间编写方法}
涨停:=C/REF(C,1)>1.0992;
XG:BARSLAST(涨停)>5 AND BARSLAST(涨停)<22
AND BARSLASTS(涨停,2)>5 AND BARSLASTS(涨停,2)<22
AND BARSLASTS(涨停,3)>66;
{第84讲筹码单峰密集过滤公式编写方法}
MJ:=8;T:=100;
A1:=COST(85);
A2:=COST(15);
A3:=A1-A2;
A4:=(A1+A2)/2;
A5:=A3/A4*100<MJ;
B1:=HHV(HIGH,T);
B2:=LLV(LOW,T);
B3:=B1-B2;
B4:=(A4-B2)<B3/2;
低位单峰密集:A5 AND B4;
{第83讲成本集中图副图公式编写方法}
获利比例:WINNER(C)*100;
平均成本:COST(50);
C95:=COST(95);
C5:=COST(5);
C85:=COST(85);
C15:=COST(15);
成本集中90:(C95-C5)/CONST(HHV(H,0))*100;
成本集中70:(C85-C15)/CONST(HHV(H,0))*100;
A1:=STRCAT('获利比例',': ');
A2:=STRCAT(CON2STR(获利比例,1),'%');
AA:=STRCAT(A1,A2);
B1:=STRCAT('平均成本',': ');
BB:=STRCAT(B1,CON2STR(平均成本,2));
C1:=STRCAT('90%成本',CON2STR(C5,2));
C2:=STRCAT('-',CON2STR(C95,2));
C3:=STRCAT('集中',CON2STR(成本集中90,1));
CC:=STRCAT(STRCAT(STRCAT(C1,C2),C3),'%');
D1:=STRCAT('70%成本',CON2STR(C15,2));
D2:=STRCAT('-',CON2STR(C85,2));
D3:=STRCAT('集中',CON2STR(成本集中70,1));
DD:=STRCAT(STRCAT(STRCAT(D1,D2),D3),'%');
DRAWTEXT_FIX(ISLASTBAR,0.7,0,0,AA);
DRAWTEXT_FIX(ISLASTBAR,0.7,0.15,0,BB);
DRAWTEXT_FIX(ISLASTBAR,0.7,0.3,0,CC);
DRAWTEXT_FIX(ISLASTBAR,0.7,0.45,0,DD);
{第82讲跳空十字星副图及过滤公式编写方法}
跳空:=L>REF(H,1);
实体大小:=ABS(C-O);
上影线:=(H-MAX(C,O))/实体大小<4 AND (H-MAX(C,O))/实体大小>1.5;
下影线:=(MIN(C,O)-L)/实体大小<4 AND (MIN(C,O)-L)/实体大小>1.5;
XG:跳空 AND 实体大小/REF(C,1)<0.03 AND 上影线 AND 下影线;
{第81讲 相对强弱指标编写方法}
N:=144;
NOTEXT0:0,COLORLIGREEN,DOTLINE;
本品种涨跌:=(C/REF(C,1)-1)*100;
品种0:=INDEXC;
品种0涨跌:=(品种0/REF(品种0,1)-1)*100;
BIAS0:=本品种涨跌-品种0涨跌;
比所属:SUM(BIAS0,N),COLOR0080FF;
DRAWTEXT(ISLASTBAR,比所属,'属'),COLOR0080FF;
品种1:=("999999$C");
品种1涨跌:=(品种1/REF(品种1,1)-1)*100;
BIAS1:=本品种涨跌-品种1涨跌;
比上证:SUM(BIAS1,N),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=10,比上证,'上'),COLORWHITE;
品种2:=("399001$C");
品种2涨跌:=(品种2/REF(品种2,1)-1)*100;
BIAS2:=本品种涨跌-品种2涨跌;
比深成指:SUM(BIAS2,N),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=15,比深成指,'深'),COLORYELLOW;
品种3:=("399006$C");
品种3涨跌:=(品种3/REF(品种3,1)-1)*100;
BIAS3:=本品种涨跌-品种3涨跌;
比创指:SUM(BIAS3,N),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=20,比创指,'创'),COLORMAGENTA;
品种4:=("000300$C");
品种4涨跌:=(品种4/REF(品种4,1)-1)*100;
BIAS4:=本品种涨跌-品种4涨跌;
比沪深300:SUM(BIAS4,N),COLORLIGRAY;
DRAWTEXT(CURRBARSCOUNT=25,比沪深300,'300'),COLORLIGRAY;
{第80讲 九阳神剑副图及过滤公式编写方法}
日K:="KDJ.K#DAY"(9,3,3);
日D:="KDJ.D#DAY"(9,3,3);
DRAWICON(日K>日D,0.5,38);
DRAWICON(日K<日D,0.5,39);
日DIF:="MACD.DIF#DAY"(12,26,9);
日DEA:="MACD.DEA#DAY"(12,26,9);
DRAWICON(日DIF>日DEA,1.5,38);
DRAWICON(日DIF<日DEA,1.5,39);
日RSI:="RSI.RSI1#DAY"(9);
DRAWICON(日RSI>50,2.5,38);
DRAWICON(日RSI<50,2.5,39);
周K:="KDJ.K#WEEK"(9,3,3);
周D:="KDJ.D#WEEK"(9,3,3);
DRAWICON(周K>周D,3.5,38);
DRAWICON(周K<周D,3.5,39);
周DIF:="MACD.DIF#WEEK"(12,26,9);
周DEA:="MACD.DEA#WEEK"(12,26,9);
DRAWICON(周DIF>周DEA,4.5,38);
DRAWICON(周DIF<周DEA,4.5,39);
周RSI:="RSI.RSI1#WEEK"(9);
DRAWICON(周RSI>50,5.5,38);
DRAWICON(周RSI<50,5.5,39);
月K:="KDJ.K#MONTH"(9,3,3);
月D:="KDJ.D#MONTH"(9,3,3);
DRAWICON(月K>月D,6.5,38);
DRAWICON(月K<月D,6.5,39);
月DIF:="MACD.DIF#MONTH"(12,26,9);
月DEA:="MACD.DEA#MONTH"(12,26,9);
DRAWICON(月DIF>月DEA,7.5,38);
DRAWICON(月DIF<月DEA,7.5,39);
月RSI:="RSI.RSI1#MONTH"(9);
DRAWICON(月RSI>50,8.5,38);
DRAWICON(月RSI<50,8.5,39);
Z1:=日K>日D;
Z2:=日DIF>日DEA;
Z3:=日RSI>50;
Z4:=周K>周D;
Z5:=周DIF>周DEA;
Z6:=周RSI>50;
Z7:=月K>月D;
Z8:=月DIF>月DEA;
Z9:=月RSI>50;
NOTEXTGZ:Z1 AND Z2 AND Z3 AND Z4 AND Z5 AND Z6 AND Z7 AND Z8 AND Z9,NODRAW;
NOTEXT0:-1,COLORBLACK;
NOTEXT9:8.5,COLORBLACK;
{第79讲首板过滤公式编写方法}
{N:1 1000 20}
涨停:=C/REF(C,1)>=1.0992;
首板:=涨停 AND COUNT(涨停,N)=1;
XG:NOT(EXIST(涨停,3)) AND EXIST(首板,4);
{第78讲红绿黄趋势跟踪主图指标编写方法}
N1:=18;N2:=50;N3:=32;
CPX:(MA(CLOSE,8)*N1/100+MA(CLOSE,30)*N2/100+MA(CLOSE,60)*N3/100)COLORYELLOW;
NOTEXTWS:=CPX>REF(CPX,1) AND MA(CLOSE,30)>REF(MA(CLOSE,30),1) AND CLOSE>CPX AND CLOSE>MA(CLOSE,30),NODRAW;
NOTEXTWX:=CPX<=REF(CPX,1) AND MA(CLOSE,30)<=REF(MA(CLOSE,30),1) AND CLOSE<CPX AND CLOSE<MA(CLOSE,30),NODRAW;
STICKLINE(C>=O,L,H,0,0),COLORYELLOW;
STICKLINE(C>=O,C,O,2,1),COLORYELLOW;
STICKLINE(C<O,L,H,0,0),COLORYELLOW;
STICKLINE(C<O,C,O,2,0),COLORYELLOW;
STICKLINE(C>=O AND NOTEXTWS=1,L,H,0,0),COLORRED;
STICKLINE(C>=O AND NOTEXTWS=1,C,O,2,1),COLORRED;
STICKLINE(C<O AND NOTEXTWS=1,L,H,0,0),COLORRED;
STICKLINE(C<O AND NOTEXTWS=1,C,O,2,0),COLORRED;
STICKLINE(C>=O AND NOTEXTWX=1,L,H,0,0),COLORCYAN;
STICKLINE(C>=O AND NOTEXTWX=1,C,O,2,1),COLORCYAN;
STICKLINE(C<O AND NOTEXTWX=1,L,H,0,0),COLORCYAN;
STICKLINE(C<O AND NOTEXTWX=1,C,O,2,0),COLORCYAN;
NOTEXT1:IF(NOTEXTWS=1,CPX,DRAWNULL),COLORRED;
NOTEXT2:IF(NOTEXTWX=1,CPX,DRAWNULL),COLORFFFF00;
DRAWICON(NOTEXTWS=1 AND NOT(REF(NOTEXTWS,1)) AND COUNT(NOTEXTWS=1,BARSLAST(NOTEXTWX=1))=1,CPX,38);
DRAWICON(NOTEXTWX=1 AND NOT(REF(NOTEXTWX,1)) AND COUNT(NOTEXTWX=1,BARSLAST(NOTEXTWS=1))=1,CPX,39);
{第77讲靠近半年最高价划线含过滤功能编写方法}
H120:=HHV(HIGH,120);
NOTEXT选股条件:H/H120>0.95 AND H/H120<1 AND HHVBARS(H,120)>60,NODRAW;
STICKLINE(NOTEXT选股条件,H120,H120,18,0)COLORYELLOW;
{第76讲在历史最高量收盘价处划线的编写方法}
ZDL时间:=HHVBARS(VOL,0);
最高量当日价:=REF(C,ZDL时间);
DRAWSL(ISLASTBAR,最高量当日价,0,ZDL时间,1),COLORGREEN,LINETHICK1;
{第75讲在成交量中显示大级别成交量的编写方法}
NOTEXTVDAY:IF(PERIOD=4 OR PERIOD=3,"VOL.VOLUME#DAY",DRAWNULL),COLORGREEN;
NOTEXTVWEEK:IF(PERIOD=5,"VOL.VOLUME#WEEK",DRAWNULL),COLORGREEN;
NOTEXTVMONTH:IF(PERIOD=6,"VOL.VOLUME#MONTH",DRAWNULL),COLORGREEN;
NOTEXTVSEASON:IF(PERIOD=7,"VOL.VOLUME#SEASON",DRAWNULL),COLORGREEN;
NOTEXTVYEAR:IF(PERIOD=10,"VOL.VOLUME#YEAR",DRAWNULL),COLORGREEN;
VOLUME:VOL,VOLSTICK;
MAVOL1:MA(VOLUME,5),COLORWHITE;
MAVOL2:MA(VOLUME,10),COLORYELLOW;
{第74讲均线粘合形态选股公式编写方法}
M5:=MA(CLOSE,5);
M10:=MA(CLOSE,10);
M20:=MA(CLOSE,20);
M30:=MA(CLOSE,30);
M60:=MA(CLOSE,60);
M120:=MA(CLOSE,120);
最大线:=MAX(MAX(MAX(M5,M10),MAX(M20,M30)),MAX(M60,M120));
最小线:=MIN(MIN(MIN(M5,M10),MIN(M20,M30)),MIN(M60,M120));
粘合:最大线/最小线<1.02;
{第73讲分是均线乖离率副图公式编写方法}
均价线:=SUM(V*C,0)/SUM(V,0);
偏离值:(C-均价线)/均价线,NODRAW;
NOTEXT0:0,COLORWHITE,LINETHICK2;
NOTEXT01:IF(偏离值>=0,0,DRAWNULL),COLORRED,LINETHICK2;
NOTEXT02:IF(偏离值<0,0,DRAWNULL),COLORCYAN,LINETHICK2;
STICKLINE(V>=0,0,偏离值,0.5,0),COLORWHITE;
STICKLINE(V>=0 AND 偏离值>0.03,0,偏离值,2,0),COLORCYAN;
STICKLINE(V>=0 AND 偏离值<-0.03,0,偏离值,2,0),COLORRED;
{第72讲实时成交额分时副图指标编写方法}
距开盘:=IF(TIME>=0930 AND TIME<=1130,(HOUR-9)*60+MINUTE-30,
IF(TIME>=1300 AND TIME<=1500,(HOUR-9-2)*60+MINUTE,DRAWNULL)),NODRAW;
分钟成交额:AMOUNT/100000000,VOLSTICK;
实时成交额:SUM(AMOUNT,距开盘+1)/100000000,NODRAW;
NOTEXT实时:SUM(AMOUNT,距开盘+1)/100000000/50;
{第71讲分时图动态显示当前成交额的编写方法}
距开盘:=IF(TIME>=0930 AND TIME<=1130,(HOUR-9)*60+MINUTE-30,
IF(TIME>=1300 AND TIME<=1500,(HOUR-9-2)*60+MINUTE,DRAWNULL)),NODRAW;
成交额:=CON2STR(SUM(AMOUNT,距开盘+1)/100000000,2);
DRAWTEXT_FIX(ISLASTBAR,0.5,0,0,STRCAT(STRCAT('实时成交额:',成交额),'亿元')),COLORGREEN;
{第70讲分时图动态显示当前价格和涨跌幅的编写方法}
NE:=IF(NAMELIKE('S') OR NAMELIKE('*S'),0.05,0.1);{适用ST股}
涨停价:=ZTPRICE(DYNAINFO(3),NE),COLORGRAY,POINTDOT,LINETHICK3;
跌停价:=DTPRICE(DYNAINFO(3),NE),COLORGRAY,POINTDOT,LINETHICK3;
{分时线 涨跌停变色}
IF(PERIOD=0 AND CLOSE=涨停价,CLOSE,DRAWNULL),LINETHICK2,COLORFF00B5;
IF(PERIOD=0 AND CLOSE=跌停价,CLOSE,DRAWNULL),LINETHICK2,COLOR00BB00;
{涨幅值 适用分时重播}
涨幅值:=IF(C=DYNAINFO(3),CON2STR(0,2),IF(C>DYNAINFO(3),CON2STR((C-DYNAINFO(3))/DYNAINFO(3)*100,2),CON2STR((DYNAINFO(3)-C)/DYNAINFO(3)*100,2)));
动态图标:=IF(涨停价=C OR 跌停价=C,STRCAT(CON2STR(C,2),'★ '),IF(C=REF(C,1),STRCAT(CON2STR(C,2),'◆ '),IF(C>REF(C,1),STRCAT(CON2STR(C,2),'▲ '),STRCAT(CON2STR(C,2),'▼ '))));
价格变化:=STRCAT(STRCAT(' ',动态图标),STRCAT(涨幅值,'%'));
{文字图标 动态跟随}
DRAWTEXT(ISLASTBAR,C*IF(DYNAINFO(3)>C,0.9973,1.0027),'');{扩显字符}
DRAWTEXT(ISLASTBAR AND C>DYNAINFO(3) ,C*1,价格变化),COLORRED;{涨幅区}
DRAWTEXT(ISLASTBAR AND C=DYNAINFO(3) ,C*1,价格变化),COLORMAGENTA;{零轴区}
DRAWTEXT(ISLASTBAR AND C<DYNAINFO(3) ,C*1,价格变化),COLOR008000;{跌幅区};
{第69讲多周期KDJ副图指标编写方法}
日J:"KDJ.J#DAY",COLORWHITE;
周J:"KDJ.J#WEEK",COLORYELLOW;
月J:"KDJ.J#MONTH",COLORMAGENTA;
STICKLINE(日J<20 AND 周J<20 AND 月J<20,MIN(日J,MIN(周J,月J)),20,4,0),COLORRED;
STICKLINE(日J>80 AND 周J>80 AND 月J>80,MAX(日J,MAX(周J,月J)),80,4,0),COLORGREEN;
{第68讲双底回归形态副图及过滤公式编写方法}
MA5:=MA(CLOSE,5);
MA10:=MA(CLOSE,10);
MA20:=MA(CLOSE,20);
MA60:=MA(CLOSE,60);
小金叉:=CROSS(MA5,MA10) AND MA5>MA60 AND MA5<MA20;
大金叉:=CROSS(MA20,MA60);
通道:=MA20>MA60 AND EVERY(MA20>MA60,BARSLAST(大金叉));
小金叉1:=BARSLAST(小金叉);
小金叉2:=REF(BARSLAST(小金叉),小金叉1+1)+小金叉1+1;
双底回归:=小金叉 AND 通道 AND COUNT(小金叉,BARSLAST(大金叉))=2 AND 小金叉2-小金叉1>15
AND HHVBARS(H,60)>30;
XG:EXIST(双底回归,10);
{第67讲短期超跌反弹副图及过滤公式编写方法}
MA4:=MA(C,4);
拐点:=MA4>REF(MA4,1) AND REF(MA4,1)<REF(MA4,2);
最高价:=HHV(H,10);
最低价:=LLV(L,10);
超跌:=(最高价-最低价)/最高价>0.25 AND HHVBARS(H,10)>LLVBARS(L,10);
XG:拐点 AND REF(超跌,1);
{第66讲布林轨道向上突破选股公式编写方法}
BOLL:=MA(CLOSE,20);
UB:=BOLL+2*STD(CLOSE,20);
LB:=BOLL-2*STD(CLOSE,20);
WB:=UB-LB;
盘整:=EVERY(C<UB,6) AND EVERY(C>BOLL,6);
突破:CROSS(C,UB) AND UB>REF(UB,1) AND LB<REF(LB,1) AND WB>REF(WB,1)
AND REF(盘整,1) AND BOLL>REF(BOLL,1);
{第65讲突然空转多选股公式编写方法}
MA5:=MA(C,5);
MA10:=MA(C,10);
MA20:=MA(C,20);
空头排列:=EVERY(MA5<MA10,9) AND EVERY(MA10<MA20,18);
大阳线:=C/REF(C,1)>1.075 AND C/O>1.045 AND CROSS(C,MA20);
XG:大阳线 AND REF(空头排列,1);
{第64讲涨停后单阳不破选股公式编写方法}
涨停:=C/REF(C,1)>1.0992;
涨停以来时间:=BARSLAST(涨停);
XG:涨停以来时间>=5 AND 涨停以来时间<=9 AND EVERY(L>REF(O,涨停以来时间),涨停以来时间) AND
C<REF(C,涨停以来时间)*1.05;
{第63讲在分时图输出实时量比线的编写方法}
{1}
昨日量5:REF(MA(V,5),1);
{2}
昨量:="昨日量5.昨日量5#DAY";
距开盘:=IF(TIME>=0930 AND TIME<=1130,(HOUR-9)*60+MINUTE-30,
IF(TIME>=1300 AND TIME<=1500,(HOUR-9-2)*60+MINUTE,DRAWNULL)),NODRAW;
SSLB:SUM(V,距开盘+1)/昨量;
{第62讲根据内外盘大小不同,分时线用不同颜色显示编写方法}
IF(DYNAINFO(22)>DYNAINFO(23),C,DRAWNULL),COLORGREEN,LINETHICK3;
IF(DYNAINFO(22)<DYNAINFO(23),C,DRAWNULL),COLORRED,LINETHICK3;
{第61讲上次分红距离现在的时间编写方法}
分红:SPLITBARS(0,1),NODRAW,COLORRED;
{第60讲个性化CCI指标编写方法}
N:=84;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:EMA((TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),5);
NOTEXTLING:0;
STICKLINE(CCI>100 AND CCI<200,0,CCI,0,0),COLORRED;
STICKLINE(CCI>=200,0,CCI,2,0),COLORRED;
STICKLINE(CCI<-100 AND CCI>-200,0,CCI,0,0),COLORFFFF00;
STICKLINE(CCI<=-200,0,CCI,2,0),COLORFFFF00;
STICKLINE(CCI>-100 AND CCI<100,0,CCI,0,0),COLORWHITE;
{第59讲粗略MACD底背离选股公式编写方法}
SHORT:=12;LONG:=26;MID:=9;
DIF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:=EMA(DIF,MID);
金叉:=CROSS(DIF,DEA);
金叉1以来:=BARSLAST(金叉);
金叉2以来:=REF(BARSLAST(金叉),金叉1以来+1)+金叉1以来+1;
XG:金叉AND REF(DIF,金叉1以来+1)>REF(DIF,金叉2以来+1) AND
REF(C,金叉1以来+1)<REF(C,金叉2以来+1) AND EVERY(DEA<0,金叉2以来+1);
{第58讲两个条件之间取区间最大值的编写方法}
副图
VOL,VOLSTICK;
MA10:=MA(C,10);
下拐点:=MA10<REF(MA10,1) AND REF(MA10,1)>=REF(MA10,2);
上拐点:=MA10>REF(MA10,1) AND REF(MA10,1)<=REF(MA10,2);
下拐以来时间:=BARSLAST(下拐点);
上拐以来时间:=BARSLAST(上拐点);
区间最大量:=REF(HHV(V,下拐以来时间),上拐以来时间+1);
ZDL:IF(MA10>REF(MA10,1),区间最大量,DRAWNULL),COLORFF00FF;
选股
MA10:=MA(C,10);
下拐点:=MA10<REF(MA10,1) AND REF(MA10,1)>=REF(MA10,2);
上拐点:=MA10>REF(MA10,1) AND REF(MA10,1)<=REF(MA10,2);
下拐以来时间:=BARSLAST(下拐点);
上拐以来时间:=BARSLAST(上拐点);
区间最大量:=REF(HHV(V,下拐以来时间),上拐以来时间+1);
ZDL:=IF(MA10>REF(MA10,1),区间最大量,DRAWNULL),COLORFF00FF;
XG:MA10>REF(MA10,1) AND CROSS(V,区间最大量);
{第57讲对均线三角价托进行涂色的编写方法}
MA60:MA(C,60),COLOR00FF00;
MA120:MA(C,120),COLORC0C0C0;
MA240:MA(C,240),COLORFF0000;
金叉1:=CROSS(MA60,MA120);
金叉2:=CROSS(MA60,MA240);
金叉3:=CROSS(MA120,MA240);
金叉1以来时间:=BARSLAST(金叉1);
金叉2以来时间:=BARSLAST(金叉2);
金叉3以来时间:=BARSLAST(金叉3);
排序:=金叉1以来时间>金叉2以来时间 AND 金叉2以来时间>金叉3以来时间;
XG:排序AND EXIST(金叉3,10) AND
金叉1以来时间-金叉3以来时间>30 AND C>MA60 AND MA60>MA120 AND MA120>MA240,NODRAW;
左半边:=MA240>MA60 AND MA60>MA120;
右半边:=MA60>MA240 AND MA240>MA120;
STICKLINE(左半边,MA60,MA120,8,0),COLORRED;
STICKLINE(右半边,MA240,MA120,8,0),COLORRED;
{第56讲经典均线三角形态选股公式编写方法}
MA60:=MA(C,60);
MA120:=MA(C,120);
MA240:=MA(C,240);
金叉1:=CROSS(MA60,MA120);
金叉2:=CROSS(MA60,MA240);
金叉3:=CROSS(MA120,MA240);
金叉1以来时间:=BARSLAST(金叉1);
金叉2以来时间:=BARSLAST(金叉2);
金叉3以来时间:=BARSLAST(金叉3);
排序:=金叉1以来时间>金叉2以来时间 AND 金叉2以来时间>金叉3以来时间;
XG:排序 AND EXIST(金叉3,10);
{第54讲在副图中显示对应大盘指数的编写方法}
DRAWKLINE(INDEXH,INDEXO,INDEXL,INDEXC);
MA(INDEXC,5);
MA(INDEXC,10);
MA(INDEXC,20);
MA(INDEXC,60);
DRAWNUMBER(ISLASTBAR,INDEXH,INDEXC),DRAWABOVE;
{第53讲黄蓝带指标编写方法}
N1:=13;
N2:=21;
MA1:=MA(C,N1);
MA2:=MA(C,N2);
STICKLINE(MA1>MA2,MA1,MA2,5,0),COLORYELLOW;
STICKLINE(MA1<MA2,MA1,MA2,5,0),COLORBLUE;
DRAWKLINE(H,O,L,C);
五均线:MA(C,5),COLORWHITE;
{第52讲跨周期均线的编写方法}
DRAWKLINE(H,O,L,C);
MA1:"MA.MA1#WEEK",COLOR00FF00,LINETHICK2;
MA2:"MA.MA2#WEEK",COLOR279FD3,LINETHICK2;
MA3:"MA.MA1#MONTH",COLORFF00FF,LINETHICK2;
MA4:"MA.MA2#MONTH",COLORLIBLUE,LINETHICK2;
MA5:"MA.MA1#SEASON",COLOR008000,LINETHICK2;
MA6:"MA.MA2#SEASON",COLORGRAY,LINETHICK2;
MA7:"MA.MA1#YEAR",COLORC08000,LINETHICK2;
DRAWTEXT(CURRBARSCOUNT=5,MA1,'5周')COLOR00FF00;
DRAWTEXT(CURRBARSCOUNT=10,MA2,'10周')COLOR279FD3;
DRAWTEXT(CURRBARSCOUNT=5,MA3,'5月')COLORFF00FF;
DRAWTEXT(CURRBARSCOUNT=10,MA4,'10月')COLORLIBLUE;
DRAWTEXT(CURRBARSCOUNT=5,MA5,'5季')COLOR008000;
DRAWTEXT(CURRBARSCOUNT=10,MA6,'10季')COLORGRAY;
DRAWTEXT(CURRBARSCOUNT=15,MA7,'5年')COLORC08000;
{第51讲在均线拐点处标记最高、最低价的编写方法}
DRAWKLINE(H,O,L,C);
五均线:MA(CLOSE,5);
上拐点:=五均线>REF(五均线,1) AND REF(五均线,1)<REF(五均线,2);
下拐点:=五均线<REF(五均线,1) AND REF(五均线,1)>REF(五均线,2);
DRAWNUMBER(上拐点,LLV(LOW,6),LLV(LOW,6)),COLORRED,DRAWABOVE;
DRAWNUMBER(下拐点,HHV(HIGH,6),HHV(HIGH,6)),COLORGREEN;
联系客服