通达信和同花顺设置代码分享

2024-10-07 投资技巧 35次阅读


之前分享的文章留言中,有朋友问到通达信和同花顺上面显示的额外信息的设置方法,在这把代码共享一下给需要的朋友。


一、通达信分时和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;


二、同花顺分时和K线上显示内容设置(题材信息显示和彩色k线)

1、同花顺软件内,打开一个K线图,右键点击【修改指标参数】,进入如下界面

2、随后点击【公式修改】,将下面这段代码copy进去点击【确定】就好了。

IF (k<=0)
 RETURN 0;
MA$1:MA(CLOSE, N1);
IF (k<=1)
 RETURN 0;
MA$2:MA(CLOSE, N2);
IF (k<=2)
 RETURN 0;
MA$3:MA(CLOSE, N3); 
IF (k<=3)
 RETURN 0;
MA$4:MA(CLOSE, N4); 
IF (k<=4)
 RETURN 0;
MA$5:MA(CLOSE, N5);
IF (k<=5)
 RETURN 0;
MA$6:MA(CLOSE, N6);
IF (k<=6)
 RETURN 0;
MA$7:MA(CLOSE, N7);
IF (k<=7)
 RETURN 0;
MA$8:MA(CLOSE, N8);

C2:=REF(C,1);

涨停:=IF((C-C2)*100/C2>=(10-0.01*100/C2),1,0);

STICKLINE (涨停, OPEN ,CLOSE,10,0),colorred;

STICKLINE(涨停,H,L,0,0),colorred;

跌停:=IF((C2-C)*100/C2>=(10-0.01*100/C2),1,0);

STICKLINE(跌停,OPEN,CLOSE,10,0),colorgreen;

STICKLINE(跌停,H,L,0,1),colorgreen;

DRAWTEXT_FIX(1,0.05,0.1,42,BLOCK(3,8)),colormagenta;
DRAWTEXT_FIX(1,0.05,0.5,0,BLOCK(0,00)+'+'+BLOCK(2.0)),colormagenta;
DRAWTEXT_FIX(1,0.05,0.9,0,LASTREP(&GDMC1,1)),colormagenta;


免责声明:以上均为个人盘后学习总结,不构成任何投资买卖建议,如有按此操作,盈亏自负,请每个人为自己的交易负责。股市有风险,入市需谨慎。

猜你感兴趣: