公式解读:
一、通达信隔日指标公式
N:=1;
日K:KDJ.K,COLORWHITE;
日D:KDJ.D,COLORYELLOW;
日J:KDJ.J,COLORMAGENTA;
周K:=KDJ.K#WEEK,NODRAW;
周D:=KDJ.D#WEEK,NODRAW;
周J:=KDJ.J#WEEK,NODRAW;
日:=CROSS(日K,日D)AND(日D 40OR日D
周金叉:=CROSS(周K,周D)AND(周D 40OR周D
:=(周金叉AND日金叉);
STICKLINE(共振,-30,100,3,0),COLORLIRED;
DRAWTEXT((周金叉AND日金叉),-5, 日周共振 ),COLORYELLOW;
DRAWTEXT((周金叉AND日金叉),5, KDJ ),COLORYELLOW;
DRAWICON((周金叉AND日金叉),-5,5);
STICKLINE(日K =日D,-15,-10,3,0),COLORLIRED;
STICKLINE(日K 日D,-15,-10,3,0),COLORLIBLUE;
STICKLINE(周K =周D,-20,-25,3,0),COLORLIRED;
STICKLINE(周K 周D,-20,-25,3,0),COLORLIBLUE;
DRAWTEXT(ISLASTBAR,-12, __日KDJ ),COLORWHITE;
DRAWTEXT(ISLASTBAR,-22, __周KDJ ),COLORWHITE;
{RSI彩条}
LC1:=REF(CLOSE,1);
RSI11:=SMA(MAX(CLOSE-LC1,0),6,1)/SMA(ABS(CLOSE-LC1),6,1)*100,NODRAW;
RSI22:=SMA(MAX(CLOSE-LC1,0),12,1)/SMA(ABS(CLOSE-LC1),12,1)*100,NODRAW;
DRAWBAND(RSI11,RGB(150,0,0),RSI22,RGB(0,0,150));
RSI1:SMA(MAX(CLOSE-LC1,0),6,1)/SMA(ABS(CLOSE-LC1),6,1)*100,COLOR000096;
RSI2:SMA(MAX(CLOSE-LC1,0),12,1)/SMA(ABS(CLOSE-LC1),12,1)*100,COLOR000096;
IF(RSI1 RSI2,DRAWNULL,RSI1),COLOR960000;
IF(RSI1 RSI2,DRAWNULL,RSI2),COLOR960000;
{KDJ底和顶背离}
A2:=BARSLAST(REF(CROSS( KDJ.K (9,3,3), KDJ.D (9,3,3)),1));
B2:=REF(C,A2+1) CANDREF( KDJ.K (9,3,3),A2+1) KDJ.K (9,3,3)ANDCROSS( KDJ.K (9,3,3), KDJ.D (9,3,3));{KDJ底背}
C2:=BARSLAST(REF(CROSS( KDJ.D (9,3,3), KDJ.K (9,3,3)),1));
D2:=REF(C,C2+1) CANDREF( KDJ.K (9,3,3),C2+1) KDJ.K (9,3,3)ANDCROSS( KDJ.D (9,3,3), KDJ.K (9,3,3));{KDJ顶背}
DRAWICON((B2 0),日J,1);
DRAWTEXT((B2 0),日J, KDJ底背 ),COLORWHITE;
DRAWICON((D2 0),日J,2);
DRAWTEXT((D2 0),日J, KDJ顶背 ),COLORGREEN;
{RSI底背离和顶背离}
A3:=BARSLAST(REF(CROSS( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24)),1));
B3:=REF(C,A3+1) CANDREF( RSI.RSI1 (6,12,24),A3+1) RSI.RSI1 (6,12,24)ANDCROSS
( RSI.RSI1 (6,12,24), RSI.RSI2 (6,12,24));
C3:=BARSLAST(REF(CROSS( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24)),1));
D3:=REF(C,C3+1) CANDREF( RSI.RSI1 (6,12,24),C3+1) RSI.RSI1 (6,12,24)ANDCROSS
( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24));
DRAWICON((D3 0),95,2);
DRAWTEXT((D3 0),95, RSI顶背 ),COLORCYAN;
DRAWICON((B3 0),20,1);
DRAWTEXT((B3 0),20, RSI底背 ),COLORRED;
{传统KDJ}
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),COLORWHITE,LINETHICK1;
D:SMA(K,3,1),COLORYELLOW,LINETHICK1;
J:3*K-2*D,COLORMAGENTA,LINETHICK1;
IF1:IF(J 10,J,DRAWNULL),COLORRED,LINETHICK2;
IF2:IF(J =80,J,DRAWNULL),COLORFF0080,LINETHICK2;
DRAWTEXT(ISLASTBAR,K, ←K ),COLORWHITE;
DRAWTEXT(ISLASTBAR,D, ←D ),COLORYELLOW;
DRAWTEXT(ISLASTBAR,J, ←J ),COLORMAGENTA;
{VAR444:=C;
操作:=MA(VAR444,4);
生命线:HHV(操作,13),LINETHICK2,COLORYELLOW;收盘破此线短逃}
愚公:=IF(1 10,HIGH*1.03,DRAWNULL),POINTDOT,LINETHICK9,COLORYELLOW;
买线:=EMA(C,5);
卖线:=EMA(SLOPE(C,20)*10+C,35);
DRAWICON(CROSS(买线,卖线),LOW*0.98,7);
DRAWICON(CROSS(卖线,买线),HIGH*1.02,8);
STICKLINE(买线 =卖线,LOW,HIGH,0,0),COLORLIRED;
STICKLINE(买线 =卖线,CLOSE,OPEN,3,2),COLORLIRED;
STICKLINE(买线 卖线,LOW,HIGH,0,0),COLORCYAN;
STICKLINE(买线 卖线,CLOSE,OPEN,3,2),COLORCYAN;
STICKLINE(OPEN CLOSE,CLOSE,OPEN,2.5,0),COLORCYAN;
MA7:EMA(CLOSE,7),COLORFFFFFF,LINETHICK2;
MID:MA(CLOSE,20),COLORYELLOW;
UPPER:MID+2*STD(CLOSE,20),COLORRED,DOTLINE;
LOWER:MID-2*STD(CLOSE,20),COLORGREEN,DOTLINE;
公式:
MA7:=EMA(CLOSE,7);
MID:=MA(CLOSE,20);
CROSS(MA7,MID);
HS:=VOL/CAPITAL*100;
TJ1:=HS TJ2:=HS TJ3:=HS TJ4:=HS
TJ5:=HS TJ6:=HS TJ7:=HS TJ8:=HS
:VOL/CAPITAL*100,NODRAW,COLORFFFF00;
量:VOL,VOLSTICK,COLORFFFF00;
盘=亿:FINANCE(7)/100000000,LINETHICK0,COLORWHITE;
每股收益:FINANCE(33),LINETHICK0,COLORYELLOW;
公积金:FINANCE(18),LINETHICK0,COLORWHITE;
市盈率:DYNAINFO(39),LINETHICK0,COLORWHITE;
地量0__1:0,COLORFFFFFF;
低靡1__2:0,COLORFFFF00;
温和2__3:0,COLOR208FFF;
活跃3__5:0,COLOR00FFFF;
带量5__8:0,COLORFF00FF;
放量8__15:0,COLOR00FF00;
巨量15__25:0,COLORFF5500;
STICKLINE(TJ1,0,V*0.3,2.3,0),COLORFFFFFF;
STICKLINE(TJ3,V,V*0.5,2.3,0),COLOR208FFF;
STICKLINE(TJ4,V,V*0.5,2.3,0),COLOR00FFFF;
STICKLINE(TJ5,V,V*0.5,2.3,0),COLORFF00FF;
STICKLINE(TJ6,V,V*0.5,2.3,0),COLOR00FF00;
STICKLINE(TJ7,V,V*0.5,2.3,0),COLORFF2900;
STICKLINE(TJ8,V,V*0.5,2.3,0),COLORFF0000;
五:MA(VOL,5),COLORWHITE,LINETHICK1;
十:MA(VOL,10),COLOR00FFFF,LINETHICK1;
M1:=5;
M2:=10;
VVOL:IF(CURRBARSCOUNT=1ANDPERIOD=5,VOL*240/FROMOPEN,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1ANDPERIOD=5,VVOL,0,(-1),(-1)),COLOR00C0C0;
VOLUME:VOL,VOLSTICK;
MAVOL1:MA(VOLUME,M1);
MAVOL2:MA(VOLUME,M2);
X_1:=1*AMOUNT;
X_2:=1*MA(AMOUNT,5);
X_3:=1*MA(AMOUNT,10);
X_4:=HHV(X_1,30)=X_1;
X_5:=HHV(X_1,60)=X_1;
X_6:=HHV(X_1,100)=X_1;
X_7:=HHV(X_1,250)=X_1;
STICKLINE(X_4,VOLUME,VOLUME*0.7,1,0),COLORMAGENTA;
STICKLINE(X_5,VOLUME,VOLUME*0.7,1,0),COLORYELLOW;
STICKLINE(X_6,VOLUME,VOLUME*0.7,1,0),COLORGREEN;
STICKLINE(X_7,VOLUME,VOLUME*0.7,1,0),COLORFF7100;
X_8:=LLV(X_1,30)=X_1;
X_9:=LLV(X_1,60)=X_1;
X_10:=LLV(X_1,100)=X_1;
X_11:=LLV(X_1,250)=X_1;
STICKLINE(X_8,(-50000),0,1,0),COLORMAGENTA;
STICKLINE(X_9,(-50000),0,1,0),COLORYELLOW;
STICKLINE(X_10,(-50000),0,1,0),COLORGREEN;
STICKLINE(X_11,(-50000),0,1,0),COLORFF7100;
IF(CROSS(0.9,1/VOL*1000 0.01ANDKDJ.J 0),VOLUME*5,0),COLORYELLOW,LINETHICK2;
MAVOL5:MA(VOLUME,5),LINETHICK3,COLORWHITE;
异动135:MA(VOLUME,135),LINETHICK4,COLORBLUE;
DRAWICON(CROSS(REF(ZIG(3,6),1),ZIG(3,6)),HIGH*0.09,9);
公式解读:
[源码注释]通达信公式动态公式解读输出DIF:收盘价的12日指数移动平均 - 收盘价的26日指数移动平均,COLOR00FFFF
输出DEA:DIF的9日指数移动平均,画白色,NODRAW,线宽为2
输出平滑异同平均:2*(DIF-DEA),画红色,NODRAW
输出DEA1:DIF的9日指数移动平均,画白色,线宽为5
DIF,如果DEA1,返回DIF,否则返回无效数,COLOR00FFFF,线宽为5
如果DIF 1日前的DIF,返回DIF,否则返回无效数,画蓝色,线宽为5
如果DIF 1日前的DIF,返回DIF,否则返回无效数,画红色,线宽为5
{}
五十成本集中:=(COST(75)-COST(25))/(COST(75)+COST(25))*100;
成本价1:COST(五十成本集中),COLORGREEN;
五十成本集中1:=100-五十成本集中;
成本价2:COST(五十成本集中1),COLORBLUE;
底部:=(COST(95)-COST(5))/(COST(95)+COST(5))*100;
底部成本价:COST(底部),COLORYELLOW;
DRAWNUMBER(CURRBARSCOUNT=1AND底部成本价,底部成本价,底部成本价),COLORYELLOW;
顶部:=100-底部;
顶部成本价:COST(顶部),COLORGREEN;
DRAWNUMBER(CURRBARSCOUNT=1AND顶部成本价,顶部成本价,顶部成本价),COLORWHITE;
均值:=(底部+顶部)/2;
均值成本:COST(均值),COLORLICYAN,LINETHICK3;
DRAWBAND(顶部成本价,RGB(68,0,1),均值成本,RGB(68,0,1));
DRAWBAND(均值成本,RGB(3,43,63),底部成本价,RGB(3,43,63));
DRAWKLINE(H,O,L,C);
DRAWNUMBER(CURRBARSCOUNT=1AND均值成本,均值成本,均值成本),COLORLIGREEN;
底部1:=REF(成本价1,2) REF(成本价1,1)AND成本价1 REF(成本价1,1);
DRAWTEXT(底部突破1,L*0.99, 大底 ),COLORCYAN;
顶部突破3:=REF(成本价2,2) REF(成本价2,1)AND成本价2 REF(成本价2,1);
顶部突破4:=REF(成本价2,2)=REF(成本价2,1)AND成本价2 REF(成本价2,1);
DRAWTEXT(顶部突破3OR顶部突破4,L*0.99, 跃 ),COLORBROWN;
买点1:=REF(均值成本,2) REF(均值成本,1)AND均值成本 REF(均值成本,1);
买点2:=REF(均值成本,2)=REF(均值成本,1)AND均值成本 REF(均值成本,1);
DRAWTEXT(买点1OR买点2ANDC O,L*0.99, 买 ),COLORMAGENTA;
底部突破:=REF(底部成本价,2) REF(底部成本价,1)AND底部成本价 REF(底部成本价,1);
DRAWTEXT(底部突破,L*0.995, 底 ),COLORWHITE;
顶部突破:=REF(顶部成本价,2) REF(顶部成本价,1)AND顶部成本价 REF(顶部成本价,1);
顶部突破2:=REF(顶部成本价,2)=REF(顶部成本价,1)AND顶部成本价 REF(顶部成本价,1);
突破顶部:=CROSS(C,顶部成本价);
突破均值成本:=CROSS(C,均值成本);
{涨幅}
涨幅:=(C-REF(C,1))/REF(C,1)*100
{压力线}
TY:=C;
HD1:=FILTER(BACKSET(FILTER(REF(TY,7)=HHV(TY,2*7+1),7),7+1),7);
LD1:=FILTER(BACKSET(FILTER(REF(TY,3)=LLV(TY,2*7+1),7),7+1),7);
A:=REF(C,BARSLAST(HD1));
B:=REF(C,BARSLAST(LD1));
T1:=BARSLAST(HD1) BARSLAST(LD1)ANDNOT(HD1);
T2:=BARSLAST(HD1) BARSLAST(LD1)ANDNOT(LD1);
顶:IF(T1,A,A),COLORFF00FF,DOTLINE;
突破:=CROSS(C,波浪顶);
DF2:=(C-REF(C,1))/REF(C,1)*100
DF3:=(C-O)/O*100
当天涨幅:(C-O)/O*100,NODRAW;
V型:=L 底部成本价ANDDF2;
V型反转2:=CROSS(C,底部成本价)ANDDF2;
V型反转3:=L 底部成本价ANDDF3;
成立:=V型反转ORV型反转2ORV型反转3;
STICKLINE(成立,HIGH,LOW,0,1),COLORRED;
STICKLINE(成立,OPEN,CLOSE,3,0),COLOR000055;
STICKLINE(成立,OPEN,CLOSE,2.7,0),COLOR000077;
STICKLINE(成立,OPEN,CLOSE,2.1,0),COLOR000099;
STICKLINE(成立,OPEN,CLOSE,1.5,0),COLOR0000BB;
STICKLINE(成立,OPEN,CLOSE,0.9,0),COLOR0000DD;
STICKLINE(成立,OPEN,CLOSE,0.3,0),COLOR0000FF;
STICKLINE(成立,O,C,0,1),COLORMAGENTA;
DRAWTEXT(成立,L*0.99, ↖狙击 ),COLOR00FFFF;
DF:=(C-REF(C,1))/REF(C,1)*100
DF4:=(C-O)/O*100
AA:=BARSLAST(DF);
突破箱体:=CROSS(C,REF(C,AA));
箱顶:DRAWLINE(DF,O,REF(DF,1),REF(O,1),1),COLORMAGENTADOTLINE;
箱顶1:DRAWLINE(DF4,O,REF(DF4,1),REF(O,1),1),COLORYELLOWDOTLINE;
箱底:=LLV(MIN(L,REF(L,AA)),AA),COLORCYAN,LINETHICK2;
反转:=CROSS(C,箱顶)ANDREF(DF,1)=1;
反转1:=CROSS(C,箱顶1)ANDREF(DF4,1)=1;
白K:突破顶部AND涨幅ANDC=H;
STICKLINE(白K,C,O,3.5,0),COLORWHITE;
DRAWTEXT(白K,L*0.99, ↖白K ),COLORWHITE;
红K:突破均值成本AND涨幅ANDC=H;
STICKLINE(红K,C,O,3.5,0),COLORRED;
DRAWTEXT(红K,L*0.99, ↖红K ),COLORRED;
黄K:反转OR反转1AND涨幅ANDC=H;
STICKLINE(黄K,C,O,3.5,0),COLORYELLOW;
DRAWTEXT(黄K,L*0.99, ↖黄K ),COLORYELLOW;
粉K:=顶部突破3OR顶部突破4AND涨幅ANDC=H;
STICKLINE(粉K,C,O,3.5,0),COLORLIRED;
DRAWTEXT(粉K,L*0.99, ↖粉K ),COLORLIRED;
绿K:买点1OR买点2AND涨幅ANDC=H;
STICKLINE(绿K,C,O,3.5,0),COLORGREEN;
DRAWTEXT(绿K,L*0.99, ↖绿K ),COLORGREEN;
A111:=COST(85);
A222:=COST(15);
A333:=A111-A222;
A444:=(A111+A222)/2;
DFMJ:=A333/A444*100 30,LINETHICK0;
B1:=HHV(HIGH,250);
B2:=LLV(LOW,250);
BH3:=B1-B2;
B4:=(A444-B2);
DW:=A444 (BH3*04+B2),LINETHICK0;
DWDF:=DWANDDFMJ;
B5:=C/REF(C,1) 1.04ANDC=H;
CMJZ:DWDFANDB4ANDWINNER(C) =0.95ANDB5;
DRAWICON(CMJZ,LOW*0.99,27);
DRAWTEXT_FIX(1,0,0.05,0, 1、☆白K:突破顶部 )COLORWHITE;
DRAWTEXT_FIX(1,0,0.10,0, 2、☆红K:突破均值成本 )COLORRED;
DRAWTEXT_FIX(1,0,0.15,0, 3、☆黄K:反转 )COLORYELLOW;
DRAWTEXT_FIX(1,0,0.20,0, 4、☆粉K:=跃 )COLORLIRED;
DRAWTEXT_FIX(1,0,0.25,0, 5、☆绿K:买 )COLORGREEN;
N:=14;
计算:=REF(CLOSE,1)*0.865;
再计算:=REF(CLOSE,13)*0.772;
流通A:=100*VOL/CAPITAL;
明买:IF((CLOSE-MIN(计算,再计算))/CLOSE 0.1ANDSUM(流通A,5)/5 1.8,10,0),
COLORRED;
0,COLORWHITE;
100,COLORWHITE;
-100,COLORWHITE;
TYP:=(HIGH+LOW+CLOSE)/3;
月:(TYP-MA(TYP,280))/(0.015*AVEDEV(TYP,280)),COLORYELLOW,LINETHICK2;
周:(TYP-MA(TYP,70))/(0.015*AVEDEV(TYP,70)),COLORGREEN,LINETHICK2;
日:(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),COLORWHITE,LINETHICK2;
BB日:=日-REF(日,1);
BB周:=周-REF(周,1);
BB月:=月-REF(月,1);
IF(BB日 =0,日,DRAWNULL),COLORRED,LINETHICK2;
IF(BB周 =0,周,DRAWNULL),COLORMAGENTA,LINETHICK2;
IF(BB月 =0,月,DRAWNULL),COLORRED,LINETHICK2;
上涨值:=MA((H+REF(L,1))/2,3);
买进高点:=MA((H+REF(H,1))/2,3);
VAR1:=((H+L+C)/3)*2-L;
突破买入值:=MA(VAR1,3);{LSS轴点突破买入值}
下跌值:=MA((REF(H,1)+L)/2,3);
卖出低点:=MA((REF(L,1)+L)/2,3);
VAR2:=((H+L+C)/3)*2-H;
突破卖出值:=MA(VAR2,3);
次日卖出点:(上涨值+买进高点+突破买入值+H)/4,LINETHICK0;
次日买入点:(下跌值+卖出低点+突破卖出值+L)/4,LINETHICK0;
日强弱指数:(C-L)/(H-L)*100;
X:=HHV(H,5)-REF(O,5);
Y:=C-LLV(L,5);
Z:=(HHV(H,5)-LLV(L,5))*2;
摆荡指标:(X+Y)/Z*100;
看跌线:30;
50;
看涨线:70;
DRAWTEXT(ISLASTBARAND(摆荡指标 =30),摆荡指标, LSS 30看跌 ),COLORGREEN;
DRAWTEXT(ISLASTBARAND(日强弱指数 =50),日强弱指数, 日强弱指数数 50看跌 ),COLORLIGREEN;
DRAWTEXT(ISLASTBARAND(摆荡指标 =70),摆荡指标, LSS 70看涨; ),COLORRED;
DRAWTEXT(ISLASTBARAND(日强弱指数 =50),日强弱指数, 日强弱指数数 50看涨; ),COLORLIMAGENTA;
{虚拟涨停K}
KXZT:=IF(CURRBARSCOUNT=1ANDPERIOD=5ANDNOT(C 150)ANDC O,REF(CLOSE,1)*1.1,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1ANDPERIOD=5,KXZT,MAX(OPEN,CLOSE),-1,-1),COLOR00C0C0;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
{虚拟跌停K}
KXDT:=IF(CURRBARSCOUNT=1ANDPERIOD=5ANDNOT(C 150)ANDC O,REF(CLOSE,1)*0.9,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1ANDPERIOD=5,KXDT,MIN(OPEN,CLOSE),-1,-1),COLORLIBLUE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
股票公式编写要求:
净利润大于50万的选股公式。
股票公式编写结果:
XG:(FINVALUE(96)/10000)