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

通达信源码精选:五彩K线,立体3D K线,自动黄金分割

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

1、五彩K线

简洁美观,简约而不简单的主图

{彩色K线}{简洁美观简约而不简单主图}
VAR1:=LLV(L,DATE);
VAR2:=HHV(H,DATE);
趋势:=EMA((C-VAR1)/(VAR2-VAR1),WEEKDAY);
AA:=趋势>=REF(趋势,1);
BB:=趋势<REF(趋势,1);
买入:DRAWICON(CROSS(AA,BB),L-0.1,23);
卖出:DRAWICON(CROSS(BB,AA),H+0.1,15);
{红}
STICKLINE(AA,C,OPEN,3.5,0),COLOR0000BB;
STICKLINE(AA,C,OPEN,2.5,0),COLOR0000CC;
STICKLINE(AA,C,OPEN,0.8,0),COLOR0000FF;
STICKLINE(AA,C,OPEN,0.1,0),COLORCC66FF;
{青}
STICKLINE(BB,C,OPEN,3.5,0),COLOR009900;
STICKLINE(BB,C,OPEN,2.5,0),COLOR00BB00;
STICKLINE(BB,C,OPEN,1.5,0),COLOR00DD00;
STICKLINE(BB,C,OPEN,0.5,0),COLOR00FF00;
STICKLINE(BB,C,OPEN,0.1,0),COLORCYAN;
{金黄色立柱}
STICKLINE(买入,O,(C-O)/2+O,3.8,0),COLOR337777;
STICKLINE(买入,O,(C-O)/2+O,2.5,0),COLOR339999;
STICKLINE(买入,O,(C-O)/2+O,1.5,0),COLOR33AAAA;
STICKLINE(买入,O,(C-O)/2+O,1,0),COLOR33CCCC;
STICKLINE(买入,O,(C-O)/2+O,0,0),COLOR33EEEE;
{粉红立柱}
STICKLINE(卖出,O,(C-O)/2+O,3.5,0),COLOR770077;
STICKLINE(卖出,O,(C-O)/2+O,2.5,0),COLOR990099;
STICKLINE(卖出,O,(C-O)/2+O,1.5,0),COLORBB00BB; 
STICKLINE(卖出,O,(C-O)/2+O,1,0),COLORDD00DD;
STICKLINE(卖出,O,(C-O)/2+O,0.1,0),COLORFF00FF;
MA5:MA(C,5),COLORWHITE,LINETHICK1;
MA10:MA(C,10),COLOR00FFFF,LINETHICK1;
MA21:MA(C,21),COLORC0FF7F,LINETHICK1;
MA60:MA(C,60),COLORFF00FF,LINETHICK1;
{老鼠仓}
AX:=AMOUNT/V;BX:=L<AX*0.9; CX:=(C-REF(C,1))/REF(C,1)*100>1.2;
DZ:=L<MA(C,5)*0.921;EX:=V<MA(V,5)*1.5;
老鼠仓:=BX AND CX AND DZ AND EX,LINETHICK0;
DRAWTEXT(老鼠仓,(L*0.99),'↖老鼠仓'),COLOR40CCFF;
RA:=ZIG(3,10); 
GG:=MA(RA,2);
DRAWICON(CROSS(GG,RA),H+0.1,15);
DRAWTEXT(CROSS(RA,GG),L*0.99,'↖买'),COLOR00FF00;
{涨跌停提示}
ZDF:=(C-REF(C,1))/REF(C,1)*100;
DRAWTEXT(C>=1.099*REF(C,1),C*1.01,'↙涨停'),COLORYELLOW;
DRAWTEXT(ZDF<-9.9,C*1.01,'↖跌停'),COLOR00FF00;
获利%:WINNER(C)*100,NODRAW,COLORFF00FF;
涨家数:INDEXADV,COLOR0000EE,NODRAW;
跌家数:INDEXDEC,COLOR00EE00,NODRAW; 
大盘成交量:INDEXV,COLOR00EEEE,NODRAW;
上市日期年:REF(YEAR,BARSCOUNT(C)-1),NODRAW,COLOR0000FF;
月:REF(MONTH,BARSCOUNT(C)-1),NODRAW,COLORFF00FF;
日:REF(DAY,BARSCOUNT(C)-1),NODRAW,COLOR00FFFF;



2、非常漂亮的【立体3D K线】

本公式是非常漂亮的3D的K线,唯美之作( 股民学院: http://www.58188.com )
 {立体3D K线}

DRAWTEXT_FIX(1,0.01,0.02,0,'【名称】:'),COLORLIGREEN;
 DRAWTEXT_FIX(1,0.08,0.02,0,STKNAME),COLORRED;
 DRAWTEXT_FIX(1,0.01,0.07,0,'【代码】:'),COLORLIGREEN;
 DRAWTEXT_FIX(1,0.08,0.07,0,CODE),COLOR0080FF;
 DRAWTEXT_FIX(1,0.01,0.12,0,'【卖一】:'),COLORLIGREEN;
 DRAWNUMBER_FIX(1,0.08,0.12,0,DYNAINFO(21)),COLORLICYAN;
 DRAWTEXT_FIX(1,0.01,0.17,0,'【买一】:'),COLORLIGREEN;
 DRAWNUMBER_FIX(1,0.08,0.17,0,DYNAINFO(20)),COLORLIBLUE;
 
BSX:=DMA(DCLOSE,5),COLORGREEN,LINETHICK3,COLORWHITE;
强弱线:=EMA(DCLOSE,21),COLORCYAN,LINETHICK3;
持股:=IF(BSX>=REF(BSX,1),BSX,DRAWNULL),COLORRED,LINETHICK3;
 LL:=REF(L,1);HH:=REF(H,1);上跳:=L>HH;下跳:=H<LL;
 STICKLINE(L>REF(H,1),L,REF(H,1),2.5,-1),COLORRED;
 STICKLINE(REF(L,1)>H,REF(L,1),H,2.5,-1),COLORGREEN;
 HD:=FILTER(BACKSET(FILTER(REF(H,10)=HHV(H,2*10+1),10),10+1),10);
 LD:=FILTER(BACKSET(FILTER(REF(L,10)=LLV(L,2*10+1),10),10+1),10);
 A:=REF(H,BARSLAST(HD));
 B:=REF(L,BARSLAST(LD));
 T1:=BARSLAST(HD)<BARSLAST(LD) AND NOT(HD);
 T2:=BARSLAST(HD)>BARSLAST(LD) AND NOT(LD);
波段顶:=IF(T1,A,A),COLORBLACK,POINTDOT;
波段底:=IF(T2,B,B),COLORBLACK,POINTDOT;
 BIAS :=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100;
 BIASMA :=MA(BIAS,21);
 AA:=BIAS>=BIASMA;
 BB:=BIAS<BIASMA;
 STICKLINE(AA,H,L,0,0),COLOR0000FF;
 STICKLINE(AA,C,O,2.7,0),COLOR000066;
 STICKLINE(AA,C,O,2.4,0),COLOR000088;
 STICKLINE(AA,C,O,2.1,0),COLOR0000AA;
 STICKLINE(AA,C,O,1.8,0),COLOR0000BB;
 STICKLINE(AA,C,O,1.5,0),COLOR0000CC;
 STICKLINE(AA,C,O,1.2,0),COLOR0000DD;
 STICKLINE(AA,C,O,0.8,0),COLOR0000EE;
 STICKLINE(AA,C,O,0.2,0),COLOR0000FF;
 STICKLINE(AA,C,O,0.1,0),COLOR0000FF;
 STICKLINE(BB,H,L,0,0),COLOR00FF00;
 STICKLINE(BB,C,O,2.7,0),COLOR006600;
 STICKLINE(BB,C,O,2.4,0),COLOR008800;
 STICKLINE(BB,C,O,2.1,0),COLOR00AA00;
 STICKLINE(BB,C,O,1.8,0),COLOR00BB00;
 STICKLINE(BB,C,O,1.5,0),COLOR00CC00;
 STICKLINE(BB,C,O,1.2,0),COLOR00DD00;
 STICKLINE(BB,C,O,0.9,0),COLOR00EE00;
 STICKLINE(BB,C,O,0.6,0),COLOR00FF00;
 STICKLINE(BB,C,O,0.1,0),COLOR00FF00;
 VAR1:=ZIG(3,10)<REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)>REF(ZIG(3,10),2);
 VAR2:=ZIG(3,10)>REF(ZIG(3,10),1) AND REF(ZIG(3,10),1)<REF(ZIG(3,10),2);
 STICKLINE(VAR1,OPEN,CLOSE,2.1,0),COLOR460046;
 STICKLINE(VAR1,OPEN,CLOSE,1.8,0),COLOR5E005E;
 STICKLINE(VAR1,OPEN,CLOSE,1.5,0),COLOR750075;
 STICKLINE(VAR1,OPEN,CLOSE,1.2,0),COLOR930093;
 STICKLINE(VAR1,OPEN,CLOSE,0.9,0),COLORAE00AE;
 STICKLINE(VAR1,OPEN,CLOSE,0.6,0),COLORD200D2;
 STICKLINE(VAR1,OPEN,CLOSE,0.4,0),COLORE800E8;
 STICKLINE(VAR1,OPEN,CLOSE,0.2,0),COLORFF00FF;
 STICKLINE(VAR1,OPEN,CLOSE,0.1,0),COLORFF44FF;
 STICKLINE(VAR2,OPEN,CLOSE,2.1,0),COLOR0077BB;
 STICKLINE(VAR2,OPEN,CLOSE,1.8,0),COLOR0088CC;
 STICKLINE(VAR2,OPEN,CLOSE,1.5,0),COLOR0099CC;
 STICKLINE(VAR2,OPEN,CLOSE,1.2,0),COLOR00AADD;
 STICKLINE(VAR2,OPEN,CLOSE,0.9,0),COLOR00BBDD;
 STICKLINE(VAR2,OPEN,CLOSE,0.6,0),COLOR00CCEE;
 STICKLINE(VAR2,OPEN,CLOSE,0.4,0),COLOR00DDEE;
 STICKLINE(VAR2,OPEN,CLOSE,0.2,0),COLOR00EEFF;
 STICKLINE(VAR2,OPEN,CLOSE,0.1,0),COLOR00FFFF;
 ZDF:=(C-REF(C,1))/REF(C,1)*100;
 STICKLINE(ZDF>9.5,C,O,2.7,0),COLOR0000CC;
 STICKLINE(ZDF>9.5,C,O,2.1,0),COLOR0000DD;
 STICKLINE(ZDF>9.5,C,O,1.2,0),COLOR0000EE;
 STICKLINE(ZDF>9.5,C,O,0.2,0),COLOR0000FF;
 STICKLINE(ZDF>9.5,HIGH,LOW,0 ,0),COLOR0000FF;
 STICKLINE(ZDF<-9.9,O,C,2.7,0),COLOR66CC66;
 STICKLINE(ZDF<-9.9,O,C,2.1,0),COLOR77DD77;
 STICKLINE(ZDF<-9.9,O,C,1.2,0),COLOR88EE88;
 STICKLINE(ZDF<-9.9,O,C,0.2,0),COLOR99FF99;
 STICKLINE(ZDF<-9.9,HIGH,LOW,0 ,0),COLOR99FF99;



3、自动黄金分割

{自动黄金分割}
全息成本曲线:SUM(CLOSE*VOL,0)/SUM(VOL,0),COLORRED,LINETHICK2;
全息成本直线:=REFDATE(SUM(CLOSE*VOL,0)/SUM(VOL,0),DATE),COLORRED,LINETHICK2;
 
市场成本曲线:DMA(AMOUNT/(100*VOL),VOL/CAPITAL),COLORBROWN,LINETHICK2; 
市场成本直线:=REFDATE(CONST(DMA(AMOUNT/(100*VOL),VOL/CAPITAL)),DATE),COLORBROWN,LINETHICK2;
 
 
机构成本曲线:COST(50),COLORRED,COLORMAGENTA,LINETHICK2;
机构成本直线:=REFDATE(CONST(COST(50)),DATE),COLORMAGENTA,LINETHICK2;
 
 
高点:=REFDATE(CONST(REF(HHV(H,0),0)),DATE),DOTLINE;
低点:=REFDATE(CONST(REF(LLV(L,0),0)),DATE),DOTLINE;
 
GD:=CONST(FINDHIGH(H,0,高点*10,1));
DD:=CONST(FINDLOW(L,0,低点*10,1));
GT:=CONST(BARSLAST(GD=H))+1;
DT:=CONST(BARSLAST(DD=L))+1;
SH:=CONST(IF(GT=1,H,REF(H,GT-1)));
SL:=CONST(IF(DT=1,L,REF(L,DT-1)));
CC:=IF(DT>GT,DT,GT);
CD:=INTPART(CC-(DT+GT)/2);
CG:=IF(高点>CD,CD/2,高点);
 
上涨周期:IF(CURRBARSCOUNT<=DT,BARSLAST(DD=L),DRAWNULL),COLORBROWN,NODRAW;
上涨幅度:IF(CURRBARSCOUNT<=DT,C/SL*100-100,DRAWNULL),NODRAW,COLORRED;
上涨均价:=IF(CURRBARSCOUNT<=DT,SUM(AMOUNT,DT)/SUM(V,DT)/100,DRAWNULL),NODRAW,COLORGRAY;
上涨换手:IF(CURRBARSCOUNT<=DT,SUM(HSL.HSL,DT),DRAWNULL),COLORMAGENTA,NODRAW;
 
下跌周期:BARSLAST(GD=H),COLORBLACK,NODRAW;
下跌幅度:IF(CURRBARSCOUNT<=GT,C/SH*100-100,DRAWNULL),NODRAW,COLORRED;
下跌均价:=IF(CURRBARSCOUNT<=GT,SUM(AMOUNT,GT)/SUM(V,GT)/100,DRAWNULL),NODRAW,COLORGRAY;
下跌换手:IF(CURRBARSCOUNT<=GT,SUM(HSL.HSL,GT),DRAWNULL),COLORBLUE,NODRAW;
 
 
{竖线表示统计起点位置}
 
上限:=CONST(HHV(H,0));
下限:=CONST(LLV(L,0));
STICKLINE(CURRBARSCOUNT=DT,上限,下限,1,0),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=GT,上限,下限,1,0),COLORGRAY;
 
{画K线} 
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
 
 
{自动黄金分割 普通等系坐标}
DRAWRECTREL(990,1,382,1,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.00,0,'100%'),COLOR00CCCC;
DRAWRECTREL(990,188,382,188,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.189,0,'19.1%'),COLOR00CCCC;
DRAWRECTREL(990,375,382,375,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.376,0,'38.2%'),COLOR00CCCC;
DRAWRECTREL(990,491,382,491,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.492,0,'50.0%'),COLOR00CCCC;
DRAWRECTREL(990,607,382,607,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.608,0,'61.8%'),COLOR00CCCC;
DRAWRECTREL(990,794,382,794,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.382,0.795,0,'80.9%'),COLOR00CCCC;
DRAWRECTREL(990,982,382,982,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.382,0.936,0,'BASE'),COLOR00CCCC;
DRAWRECTREL(990,232,382,232,RGB(100,100,0));
DRAWRECTREL(990,144.6,382,144.6,RGB(100,100,0));
DRAWRECTREL(990,750,382,750,RGB(100,100,0));
DRAWRECTREL(990,839,382,839,RGB(100,100,0));
 
 
{画K线} 
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);

上一篇:通达信源码精选:神买神卖 顶底趋势 龙腾虎跃

下一篇:通达信源码精选:换手异动,涨跌周期分析,自用分时主图