当前位置: 网站首页 > 股票软件公式 > 通达信公式 > 文章 当前位置: 通达信公式 > 文章

通达信源码精选:财务K线综合,两色K线主图,分型顶底主图

点击: 次    来源:顶尖财经    作者:股市狙击 - 小 + 大

1、财务K线综合

{财务K线综合}

DRAWTEXT_FIX(1,0.00,0,0,'所属行业:')COLOR0080FF;
DRAWTEXT_FIX(1,0.07,0,0,HYBLOCK)COLOR0080FF;
DRAWTEXT_FIX(1,0.14,0,0,'所属地区:')COLOR00FFFF;
DRAWTEXT_FIX(1,0.21,0,0,DYBLOCK)COLOR00FFFF;
DRAWTEXT_FIX(1,0.00,0.06,0,'主题投资:')COLOR0000FF;
DRAWTEXT_FIX(1,0.07,0.06,0,EXTERNSTR(0,1))COLOR0000FF;
{股本市值}
总股本:=STRCAT(STRCAT('总股本: ',CON2STR(TOTALCAPITAL/1000000,2)),'亿');
流通盘:=STRCAT(STRCAT(' 流通盘: ',CON2STR(CAPITAL/1000000,2)),'亿');
全流通:=STRCAT(' 全流通: ',CON2STR((CAPITAL/1000000)/(TOTALCAPITAL/1000000),2));
 
 
市值:=STRCAT(STRCAT(' 流通市值: ',CON2STR((CAPITAL/1000000)*C,2)),'亿');
上市天数:=STRCAT(' 上市天数: ',CON2STR(FINANCE(42),0));
{上市日期:=STRCAT(' 上市日期: ',CON2STR(HHV((BARSCOUNT(C)=0)*(DATE+19000000),0),0));}
股本市值:=STRCAT('股本市值: ',STRCAT(STRCAT(STRCAT(STRCAT(总股本,流通盘),全流通),市值),上市天数));
{业绩综合}
市盈率:=STRCAT('市盈率: ',CON2STR(C/FINANCE(33),2));
市销率:=STRCAT(' 市销率: ',CON2STR(C/(FINANCE(20)/FINANCE(1)),2));
市净率:=STRCAT(' 市净率: ',CON2STR(C/FINANCE(34),2));
净资收益率:=STRCAT(' 净资收益率: ',CON2STR(FINANCE(33)/FINANCE(34)*100,2));
毛利率:=STRCAT(' 毛利率: ',CON2STR((FINANCE(20)-FINANCE(21))/FINANCE(20)*100,2));
 
净利润率:=STRCAT(' 净利润率 ',CON2STR(FINANCE(30)/FINANCE(20)*100,2));
主营利润率:=STRCAT(' 主营利润率 ',CON2STR(FINANCE(23)/FINANCE(20)*100,2));
当前业绩:=STRCAT('当前业绩: ',STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(市盈率,市销率),市净率),净资收益率),毛利率),净利润率),主营利润率));
{风险系数}
X1:=(FINANCE(11)-FINANCE(15))/FINANCE(10)*1.2;
X2:=(FINANCE(31)+FINANCE(17))/FINANCE(10)*1.4;{盈余公积用资本公积金代替};
X3:=FINANCE(23)/FINANCE(10)*3.3;
X4:=FINANCE(19)/FINANCE(15)*0.6;{缺长期负债或负债总额}
X5:=FINANCE(20)/FINANCE(15)*0.999;
Z值:=X1+X2+X3+X4+X5;
预警:=IF(Z值<1.2,'重警',IF(Z值>=1.2 AND Z值<2.6,'轻警','无警'));
财务预警:=STRCAT('财务预警: ',STRCAT(预警,STRCAT('-Z值: ',CON2STR(Z值,3))));
 
优质资产率:=STRCAT(' 优质资产率: ',CON2STR((FINANCE(19)-FINANCE(22)-FINANCE(27))/FINANCE(19),2));{理论上越大越好但不同行业有不同标准};
现金负债比:=STRCAT(' 现金负债比: ',CON2STR(FINANCE(25)/FINANCE(15),3));{缺长期负债或负债总额,理论上越大越好但不同行业有不同标准};
财务系数:=STRCAT('风险系数: ',STRCAT(STRCAT(财务预警,优质资产率),现金负债比));
 
DRAWTEXT_FIX(ISLASTBAR,0.00,0.12,0,股本市值),COLORGREEN;
DRAWTEXT_FIX(ISLASTBAR,0.00,0.18,0,当前业绩),COLORGREEN;
DRAWTEXT_FIX(ISLASTBAR,0.00,0.24,0,财务系数),COLORGREEN;
 
无穷:DMA(CLOSE,(VOL)/(CAPITAL));
XG:=CROSS(C,无穷) AND V>REF(V,1)*1.618;
STICKLINE(C/REF(C,1)>1.095,C,O,2,0),COLORMAGENTA;
STICKLINE(C/REF(C,1)<0.95,C,O,2,0),COLORGREEN;



2、两色K线主图

{两色K线主图}

TR1:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
 ATR:=EMA(TR1,10);
 VAR1:=REF(CLOSE,1)-REF(ATR,1);
 LSX:HHV(VAR1,13),LINETHICK1,COLORLIBLUE;
 LSX1:IF(C>=LSX,LSX,DRAWNULL),COLORMAGENTA,LINETHICK2;
 {划K线}
 STICKLINE(C>=LSX,O,C,2.5,1),COLORRED;
 STICKLINE(C>=LSX AND C>=O,C,H,0,1),COLORRED;
 STICKLINE(C>=LSX AND C>=O,O,L,0,1),COLORRED;
 STICKLINE(C>=LSX AND C<O,O,H,0,1),COLORRED;
 STICKLINE(C>=LSX AND C<O,C,L,0,1),COLORRED;
 STICKLINE(C<LSX,O,C,2.5,1),COLORGREEN;
 STICKLINE(C<LSX AND C>O,C,H,0,1),COLORGREEN;
 STICKLINE(C<LSX AND C>O,O,L,0,1),COLORGREEN;
 STICKLINE(C<LSX AND C<O,O,H,0,1),COLORGREEN;
 STICKLINE(C<LSX AND C<O,C,L,0,1),COLORGREEN;
{股民学院 www.58188.com 整理}




3、分型顶底主图

{分型顶底主图}
重心线:(H+L+O+C*3)/6;
NX:=(3*CLOSE+LOW+OPEN+HIGH)/6;    
牛线:(20*NX+19*REF(NX,1)+18*REF(NX,2)+17*REF(NX,3)+16*REF(NX,4)    
+15*REF(NX,5)+14*REF(NX,6)+13*REF(NX,7)+12*REF(NX,8)+11*REF(NX,9)    
+10*REF(NX,10)+9*REF(NX,11)+8*REF(NX,12)+7*REF(NX,13)+6*REF(NX,14)    
+5*REF(NX,15)+4*REF(NX,16)+3*REF(NX,17)    +2*REF(NX,18)+REF(NX,20))/210;
牛熊线:MA(牛线,6),COLORGREEN,LINETHICK2;
顶:=BBI+3*STD(BBI,13),COLOR004AFF;
底:=BBI-3*STD(BBI,13),COLOR67FF00;
KU1:=IF(HIGH=HHV(HIGH,3),1,0);
KD1:=IF(LOW=LLV(LOW,3),1,0);
UL:=IF(REF(KU1,2)=1 AND REF(KU1,1)=0
AND KU1=0,REF(HIGH,2),REF(HIGH,2+BARSLAST(REF(KU1,2)=1
AND REF(KU1,1)=0 AND KU1=0)));
DL:=IF(REF(KD1,2)=1 AND REF(KD1,1)=0
AND KD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1
AND REF(KD1,1)=0 AND KD1=0)));
HV:=H>UL AND H>REF(H,1);
LV:=L<DL AND L<REF(L,1);
GP:=BARSLAST(HV);
DP:=BARSLAST(LV);
IP:=IF(GP=0,DP,GP)>3;
HHV1:=HV AND IP AND H>=HHV(H,BARSLAST(LV));
LV1:=LV AND IP AND L<=LLV(L,BARSLAST(HV));
V00:=HIGH<REF(HIGH,1) AND LOW<REF(LOW,1);
V01:=HIGH<REF(HIGH,1) AND LOW>REF(LOW,1);
V02:=HIGH>REF(HIGH,1) AND LOW<REF(LOW,1);
V03:=HIGH>REF(HIGH,1) AND LOW>REF(LOW,1);
V04:=REF(HIGH,2)<HIGH AND REF(LOW,2)<LOW
AND REF(HIGH,2)>REF(HIGH,1) AND REF(LOW,2)<REF(LOW,1);
V1:=COUNT(V00,6)>=3 AND COUNT(V01 OR V02,5)=0 AND LLVBARS(LOW,6)=1 AND HHVBARS(HIGH,6)>=5 AND V03;
V2:=COUNT(V00,7)>=3 AND COUNT(V01 OR V02,6)=1 AND LLVBARS(LOW,7)=2 AND HHVBARS(HIGH,7)>=6 AND V04;
V3:=COUNT(V00,7)>=3 AND COUNT(V01 OR V02,6)=1 AND LLVBARS(LOW,7)=1 AND HHVBARS(HIGH,7)>=6 AND V03;
V4:=COUNT(V00,8)>=3 AND COUNT(V01 OR V02,7)<=2 AND LLVBARS(LOW,8)=2 AND HHVBARS(HIGH,8)>=7 AND V04;
V5:=COUNT(V00,8)>=3 AND COUNT(V01 OR V02,7)<=2 AND LLVBARS(LOW,8)=1 AND HHVBARS(HIGH,8)>=7 AND V03;
V6:=COUNT(V00,9)>=3 AND COUNT(V01 OR V02,8)<=3 AND LLVBARS(LOW,9)=2 AND HHVBARS(HIGH,9)>=8 AND V04;
V7:=COUNT(V00,9)>=3 AND COUNT(V01 OR V02,8)<=3 AND LLVBARS(LOW,9)=1 AND HHVBARS(HIGH,9)>=8 AND V03;
V8:=COUNT(V00,10)>=3 AND COUNT(V01 OR V02,9)<=4 AND LLVBARS(LOW,10)=2 AND HHVBARS(HIGH,10)>=9 AND V04;
V9:=COUNT(V00,10)>=3 AND COUNT(V01 OR V02,9)<=4 AND LLVBARS(LOW,10)=1 AND HHVBARS(HIGH,10)>=9 AND V03;
V10:=COUNT(V00,11)>=3 AND COUNT(V01 OR V02,10)<=5 AND LLVBARS(LOW,11)=2 AND HHVBARS(HIGH,11)>=10 AND V04;
XG:=V1 OR V2 OR V3 OR V4 OR V5 OR V6 OR V7 OR V8 OR V9 OR V10;
HV00:=HIGH>REF(HIGH,1) AND LOW>REF(LOW,1);
HV01:=HIGH<REF(HIGH,1) AND LOW>REF(LOW,1);
HV02:=HIGH>REF(HIGH,1) AND LOW<REF(LOW,1);
HV03:=HIGH<REF(HIGH,1) AND LOW<REF(LOW,1);
HV04:=REF(HIGH,2)>HIGH AND REF(LOW,2)>LOW AND REF(HIGH,2)>REF(HIGH,1) AND REF(LOW,2)<REF(LOW,1);
HV1:=COUNT(HV00,6)>=3 AND COUNT(HV01 OR HV02,5)=0 AND HHVBARS(HIGH,6)=1 AND LLVBARS(LOW,6)>=5 AND HV03;
HV2:=COUNT(HV00,7)>=3 AND COUNT(HV01 OR HV02,6)=1 AND HHVBARS(HIGH,7)=2 AND LLVBARS(LOW,7)>=6 AND HV04;
HV3:=COUNT(HV00,7)>=3 AND COUNT(HV01 OR HV02,6)=1 AND HHVBARS(HIGH,7)=1 AND LLVBARS(LOW,7)>=6 AND HV03;
HV4:=COUNT(HV00,8)>=3 AND COUNT(HV01 OR HV02,7)<=2 AND HHVBARS(HIGH,8)=2 AND LLVBARS(LOW,8)>=7 AND HV04;
HV5:=COUNT(HV00,8)>=3 AND COUNT(HV01 OR HV02,7)<=2 AND HHVBARS(HIGH,8)=1 AND LLVBARS(LOW,8)>=7 AND HV03;
HV6:=COUNT(HV00,9)>=3 AND COUNT(HV01 OR HV02,8)<=3 AND HHVBARS(HIGH,9)=2 AND LLVBARS(LOW,9)>=8 AND HV04;
HV7:=COUNT(HV00,9)>=3 AND COUNT(HV01 OR HV02,8)<=3 AND HHVBARS(HIGH,9)=1 AND LLVBARS(LOW,9)>=8 AND HV03;
HV8:=COUNT(HV00,10)>=3 AND COUNT(HV01 OR HV02,9)<=4 AND HHVBARS(HIGH,10)=2 AND LLVBARS(LOW,10)>=9 AND HV04;
HV9:=COUNT(HV00,10)>=3 AND COUNT(HV01 OR HV02,9)<=4 AND HHVBARS(HIGH,10)=1 AND LLVBARS(LOW,10)>=9 AND HV03;
HV10:=COUNT(HV00,11)>=3 AND COUNT(HV01 OR HV02,10)<=5 AND HHVBARS(HIGH,11)=2 AND LLVBARS(LOW,11)>=10 AND HV04;
HXG:=HV1 OR HV2 OR HV3 OR HV4 OR HV5 OR HV6 OR HV7 OR HV8 OR HV9 OR HV10;
底分型:FILTER(XG=1,5) AND 重心线<10.5 AND 牛线<12 AND 牛熊线<10.2,COLORYELLOW,NODRAW;
顶分型:FILTER(HXG=1,3),NODRAW;
DRAWBAND(BBI,RGB(97,95,00),顶,RGB(97,95,00));
DRAWBAND(BBI,RGB(25,75,150),底,RGB(25,75,250));
{用DRAWLINE函数(属于未来函数)绘制直线段,不喜欢的可以删除下面两句公式}
DRAWLINE(LV1,LOW,HHV1,HIGH,0),COLORYELLOW,LINETHICK2;
DRAWLINE(HHV1,HIGH,LV1,LOW,0),COLORMAGENTA,LINETHICK2;
STICKLINE(CLOSE>REF(CLOSE,1),HIGH,LOW,0,1),COLORRED;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,3,0),COLOR000055;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,2.7,0),COLOR000077;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,2.1,0),COLOR000099;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,1.5,0),COLOR0000BB;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,0.9,0),COLOR0000DD;
STICKLINE(CLOSE>REF(CLOSE,1),OPEN,CLOSE,0.3,0),COLOR0000FF;
STICKLINE(CLOSE=REF(CLOSE,1),HIGH,LOW,0,1),COLORWHITE;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,3,0),COLOR555555;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,2.7,0),COLOR777777;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,2.1,0),COLOR999999;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,1.5,0),COLORBBBBBB;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,0.9,0),COLORDDDDDD;
STICKLINE(CLOSE=REF(CLOSE,1),OPEN,CLOSE,0.3,0),COLORFFFFFF;
STICKLINE(CLOSE<REF(CLOSE,1),HIGH,LOW,0,1),COLORCYAN;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,3,0),COLOR990000;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,2.7,0),COLORCC0000;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,2.1,0),COLORFF4400;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,1.5,0),COLORFF8800;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,0.9,0),COLORFFCC00;
STICKLINE(CLOSE<REF(CLOSE,1),OPEN,CLOSE,0.3,0),COLORCYAN;
DRAWTEXT(FILTER(XG=1,5) AND 重心线<10.5 AND 牛线<12 AND 牛熊线<10.2,L*0.97,'底分型'),COLORYELLOW;
DRAWTEXT(FILTER(HXG=1,3),H*1.02,'顶分型');

上一篇:通达信源码精选:金山银都副图,天下无贼,强弱K线指标

下一篇:通达信公式下载:CDHD源码混搭,筹码看顶底,刀小升龙霸