之前分享的文章留言中,有朋友问到通达信和同花顺上面显示的额外信息的设置方法,在这把代码共享一下给需要的朋友。
一、通达信分时和K线上显示内容设置(个股题材等信息显示和彩色k线)
1、在通达信k线图界面上点击右键,【主图指标】->【修改当前指标公式】,进入如下界面:
2、将如下这段代码copy进去,测试结果ok,然后点击【确定】就好了。
CS1:=IF(CODELIKE('688'),0.2,IF(CODELIKE('300'),0.2,(IF(CODELIKE('301'),0.2,0.1))));
MA1:MA(CLOSE,M1);
MA2:MA(CLOSE,M2);
MA3:MA(CLOSE,M3);
MA4:MA(CLOSE,M4);
MA5:MA(CLOSE,M5);
MA6:MA(CLOSE,M6);
MA7:MA(CLOSE,M7);
MA8:MA(CLOSE,M8);
STICKLINE(C>=ZTPRICE(REF(C,1),CS1),C,O,2.7,0),COLORFF33FF;
STICKLINE(C>=ZTPRICE(REF(C,1),CS1),L,H,0,0),COLORFF33FF;
STICKLINE(C<=DTPRICE(REF(C,1),CS1),C,O,2.5,0),COLORGREEN;
STICKLINE(C<=DTPRICE(REF(C,1),CS1),L,H,0,0),COLORGREEN;
DRAWTEXT_FIX(1,0,0,0,'【行业】:'),COLORWHITE;
DRAWTEXT_FIX(1,0.1,0,0,HYBLOCK),COLORWHITE;{行业}
DRAWTEXT_FIX(1,0,0.1,0,'【概念】:'),COLORYELLOW;
DRAWTEXT_FIX(1,0.1,0.1,0,GNBLOCK),COLORLIMAGENTA;{概念};
总股本:=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));
A:=DAYTODATE(DATETODAY(CONST(DATE))-FINANCE(42))+19000000;
上市日期:=STRCAT(' 上市日期: ',CON2STR(A,0));
股本市值:=STRCAT('股本市值: ',STRCAT(STRCAT(STRCAT(STRCAT(STRCAT(总股本,流通盘),全流通),市值),上市天数),上市日期));
DRAWTEXT_FIX(ISLASTBAR,0.005,0.2,0,股本市值),COLORLIMAGENTA;
竞价成交额:=DYNAINFO(15)/10000;
占昨成交比:=DYNAINFO(15)/昨量昨额.昨额#DAY*100;
竞价成交量:=DYNAINFO(15)/DYNAINFO(4)/1000000;
占昨量比:=竞价成交量/昨量昨额.昨量#DAY*1000000;
年最大量:=HHV(V,240)/10000;
月最小量:=LLV(V,21)/10000;
DRAWTEXT_FIX(1,0,0.3,0,STRCAT(STRCAT('【竞价成交额】',CON2STR(竞价成交额,2)),'万元')),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.4,0,STRCAT(STRCAT('【占昨成交比】',CON2STR(占昨成交比,2)),'%')),COLORMAGENTA;
DRAWTEXT_FIX(1,0,0.5,0,STRCAT(STRCAT('【竞价成交量】',CON2STR(竞价成交量,2)),'万手')),COLORYELLOW;
DRAWTEXT_FIX(1,0,0.6,0,STRCAT(STRCAT('【占昨量比】',CON2STR(占昨量比,2)),'%')),COLORMAGENTA;
DRAWTEXT_FIX(1,0,0.7,0,STRCAT(STRCAT('【年最大量】',CON2STR(年最大量,2)),'万手')),COLORRED;
DRAWTEXT_FIX(1,0,0.8,0,STRCAT(STRCAT('【月最小量】',CON2STR(月最小量,2)),'万手')),COLORGREEN;
今日涨停:REF(CLOSE,1)*(1+CS1),LINETHICK0;
今日跌停:REF(CLOSE,1)*(1-CS1),LINETHICK0;
明日涨停:REF(CLOSE,1)*(1+CS1)*(1+CS1),LINETHICK0;
明日跌停:REF(CLOSE,1)*(1-CS1)*(1-CS1),LINETHICK0;
DRAWLINE(CURRBARSCOUNT=TOTALBARSCOUNT,CONST(今日涨停),CURRBARSCOUNT=1,今日涨停,3),DOTLINE;
DRAWLINE(CURRBARSCOUNT=TOTALBARSCOUNT,CONST(今日跌停),CURRBARSCOUNT=1,今日跌停,3),DOTLINE;
DRAWLINE(CURRBARSCOUNT=TOTALBARSCOUNT,CONST(明日涨停),CURRBARSCOUNT=1,明日涨停,3),DOTLINE;
DRAWLINE(CURRBARSCOUNT=TOTALBARSCOUNT,CONST(明日跌停),CURRBARSCOUNT=1,明日跌停,3),DOTLINE;
{STICKLINE(ISLASTBAR,今日涨停,今日涨停,10,0),COLORRED;}
{STICKLINE(ISLASTBAR,今日跌停,今日跌停,10,0),COLORCYAN;}
DRAWTEXT(ISLASTBAR,今日涨停*1.01,'今涨停'),COLORRED;
DRAWTEXT(ISLASTBAR,今日跌停*0.98,'今跌停'),COLORCYAN;
{STICKLINE(ISLASTBAR,明日涨停,明日涨停,10,0),COLORRED;}
{STICKLINE(ISLASTBAR,明日跌停,明日跌停,10,0),COLORCYAN;}
DRAWTEXT(ISLASTBAR,明日涨停*1.01,'明涨停'),COLORRED;
DRAWTEXT(ISLASTBAR,明日跌停*0.98,'明跌停'),COLORCYAN;