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

通达信源码:资金模型+双轨通道+画三角主图

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

资金模型

含有L2函数,普通的通达信,不会显示。

 

NOTEXT1:0,DOTLINE;

NOTEXT2:150,DOTLINE;

NOTEXT3:300,POINTDOT,COLORWHITE;

{资金控盘模型}

VAR1:=EMA(EMA(C,9),9);

控盘:=(VAR1-REF(VAR1,1))/REF(VAR1,1)*1000;

VAR2:=控盘-REF(控盘,1);

高度控盘:IF(控盘>REF(控盘,1) AND 控盘>=0 AND V>0,1,0),NODRAW,COLORRED;

平衡控盘:IF(控盘>0 AND 高度控盘==0 AND V>0,1,0),NODRAW,COLORYELLOW;

无序控盘:IF(控盘<0 AND V>0,1,0),NODRAW,COLORCYAN;

VAR3:=EMA(C,34)*0.5234;

控盘曲线:=EMA(EMA(VAR3,2),2);

STICKLINE(高度控盘,300+0,300+ABS(VAR2)*10,2,0),COLORRED;

STICKLINE(平衡控盘,300+0,300+ABS(VAR2)*10,2,0),COLORYELLOW;

STICKLINE(无序控盘,300+0,300-ABS(VAR2)*10,2,0),COLORCYAN;

{资金动力模型}

超B:=L2_AMO(0,2)/1000000;

大B:=L2_AMO(1,2)/1000000;

中B:=L2_AMO(2,2)/1000000;

小B:=L2_AMO(3,2)/1000000;

超S:=L2_AMO(0,3)/1000000;

大S:=L2_AMO(1,3)/1000000;

中S:=L2_AMO(2,3)/1000000;

小S:=L2_AMO(3,3)/1000000;

主力净买:=(超B+大B)-(超S+大S),NODRAW;

正基准线1:=EMA(EMA(EMA(EMA(IF(主力净买>=0,主力净买,0),20),2),2),2);

正基准线6:=正基准线1*6;

负基准线1:=EMA(EMA(EMA(EMA(IF(主力净买<0,主力净买,0),20),2),2),2);

负基准线6:=负基准线1*6;

衰减系数正:=(C-L)/(REF(C,1)-L);

衰减系数负:=(H-C)/(H-REF(C,1));

动力评估:=IF(正基准线1>0 OR 正基准线1<0,IFF(主力净买>=正基准线6,100,IFF(主力净买>=0,100*(主力净买/正基准线6),IFF(主力净买<=负基准线6,-100,(-100)*主力净买/负基准线6))),DRAWNULL);

动力综合值:=IF(动力评估>=0 AND C>=REF(C,1),动力评估*1.0,IFF(动力评估>=0 AND C<REF(C,1),动力评估*衰减系数正,IFF(动力评估<0 AND C>=REF(C,1),动力评估*衰减系数负,IFF(动力评估<0 AND C<REF(C,1),动力评估*1.0,0)))),NODRAW;

资金动力强:IF(动力综合值>50,动力综合值,0),COLORRED,NODRAW;

资金动力中:IF(动力综合值<=50 AND 动力综合值>0,动力综合值,0),COLORYELLOW,NODRAW;

资金动力弱:IF(动力综合值<=0,动力综合值,0),COLORFFFF00,NODRAW;

STICKLINE(动力综合值>50,150+0,150+动力综合值,2,0),COLORRED;

STICKLINE(动力综合值<=50 AND 动力综合值>0,150+0,150+动力综合值,2,0),COLORYELLOW;

STICKLINE(动力综合值<=0,150+0,150+动力综合值,2,0),COLORCYAN;

{主力阵地模型}

VAR11:=REF((L+O+C+H)/4,1);

VAR12:=SMA(ABS(L-VAR11),13,1)/SMA(MAX(L-VAR11,0),10,1);

VAR13:=EMA(VAR12,10);

VAR14:=LLV(L,33);

VAR15:=EMA(IF(L<=VAR14,VAR13,0),3);

主力阵地:IF(VAR15>REF(VAR15,4),1,0),NODRAW,COLORFFFF00;

净买:IF(主力阵地,((超B+大B+中B+小B)-(超S+大S+中S+小S)),0),NODRAW;

主动追价吸筹:IF(主力阵地 AND 净买>0,1,0),NODRAW,COLORRED;

借势打压低吸:IF(主力阵地 AND 净买<=0,1,0),NODRAW,COLORGREEN;

STICKLINE(主力阵地 AND 净买>0,0,净买,2,0),COLORRED;

STICKLINE(主力阵地 AND 净买<=0,0,净买,2,0),COLORGREEN;

 



双轨通道:

{趋势买卖}
上上轨A:=MEMA((3*C+H+O+L)/6,30)*1.1;
下下轨A:=MEMA((3*C+H+O+L)/6,30)*0.9;
DRAWBAND(上上轨A,RGB(30,50,80),下下轨A,0);
DRAWKLINE(H,O,L,C);
上上轨:EMA((3*C+H+O+L)/6,30)*1.09,COLORGREEN,NODRAW;
中上轨:EMA(2*EMA(EMA(H,34),34)-EMA(EMA(L,34),34),5),COLORBLUE,LINETHICK2;
中下轨:EMA(2*EMA(EMA(L,21),21)-EMA(EMA(H,21),21),5),COLORYELLOW,LINETHICK2;
下下轨:EMA((3*C+H+O+L)/6,30)*0.89,COLORMAGENTA,NODRAW;
 
DDTD:=DMA(C,ABS(C-MA(C,14))/MA(C,14));
上布:EMA(DDTD,30)*1.11,COLORGREEN;
下布:EMA(DDTD,30)*0.91,COLORMAGENTA;
STICKLINE(中下轨>LOW AND 中下轨<HIGH,中下轨,MIN(MIN(OPEN,CLOSE),中下轨),3,0),COLORYELLOW;
STICKLINE(中下轨>MIN(C,O) AND 中下轨<MAX(C,O),中下轨,MIN(OPEN,CLOSE),3,0),COLORYELLOW;
STICKLINE(中下轨>HIGH,OPEN,CLOSE,3,0),COLORYELLOW;
STICKLINE(中下轨>HIGH,HIGH,LOW,0,0),COLORYELLOW;
 
STICKLINE(上上轨>LOW AND 上上轨<HIGH,上上轨,MAX(上上轨,MAX(OPEN,CLOSE)),3,0),COLORGREEN;
STICKLINE(上上轨>MIN(C,O) AND 上上轨<MAX(C,O),上上轨,MAX(OPEN,CLOSE),3,0),COLORGREEN;
STICKLINE(上上轨>LOW AND 上上轨<HIGH,上上轨,HIGH,0,0),COLORGREEN;
STICKLINE(上上轨<LOW,OPEN,CLOSE,3,0),COLORGREEN;
STICKLINE(下下轨>LOW AND 下下轨<HIGH,下下轨,MIN(MIN(OPEN,CLOSE),下下轨),3,0),COLORMAGENTA;
STICKLINE(下下轨>MIN(C,O) AND 下下轨<MAX(C,O),下下轨,MIN(OPEN,CLOSE),3,0),COLORMAGENTA;
STICKLINE(下下轨>LOW AND 下下轨<HIGH,下下轨,LOW,0,0),COLORMAGENTA;
STICKLINE(下下轨>HIGH,OPEN,CLOSE,3,0),COLORMAGENTA;
 
{逃顶}
LC:=REF(CLOSE,1);
RSI5:=SMA(MAX(CLOSE-LC,0),5,1)/SMA(ABS(CLOSE-LC),5,1)*100;
逃命:=CROSS(80,RSI5);
DRAWICON(逃命,H*1.02,15);
 
TJ1:=REF("CCI.CCI",1)>90 AND "CCI.CCI"<REF("CCI.CCI",1);
TJ2:=REF("KDJ.J"(9,3,3),1)>90 AND "KDJ.J"(9,3,3)<REF( "KDJ.J"(9,3,3),1);
TJ3:=REF("RSI.RSI1",1)>70 AND "RSI.RSI1"<REF("RSI.RSI1",1);
TJ4:=COUNT(TJ1,5) AND COUNT(TJ2,5) AND COUNT(TJ3,5);
大顶:=CROSS(TJ4,0.5);
DRAWICON(大顶,H*1.05,2);
 
TJ5:=REF("CCI.CCI",1)<-100 AND "CCI.CCI">REF("CCI.CCI",1);
TJ6:=REF("KDJ.J"(9,3,3),1)<20 AND "KDJ.J"(9,3,3)>REF( "KDJ.J"(9,3,3),1);
TJ7:=REF("RSI.RSI1",1)<20 AND "RSI.RSI1">REF("RSI.RSI1",1);
TJ8:=COUNT(TJ5,5) AND COUNT(TJ6,5) AND COUNT(TJ7,5);
大底:=CROSS(TJ8,0.5);
DRAWICON(大底,L*0.95,23);




画三角主图:

自动划图公式 画三角主图(顶尖财经 股票学院: http://58188.com)

{通达信三角主图}
A10304:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B10304:=FILTER(A10304,3);
C10304:=BACKSET(B10304,3+1);
D10304:=FILTER(C10304,3);{高点}
A20304:=REF(LOW,3)=LLV(LOW,2*3+1);
B20304:=FILTER(A20304,3);
C20304:=BACKSET(B20304,3+1);
D20304:=FILTER(C20304,3);{低点}
E10304:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E20304:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
H10304:=(D10304 AND NOT(D20304 AND E10304>=E20304)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
H20304:=D10304 AND NOT(D20304 AND E10304>=E20304);
L10304:=D20304 AND NOT(D10304 AND E10304=E20304);
X10304:=REF(BARSLAST(H10304),1)+1;
F10304:=BACKSET(H10304 AND COUNT(L10304,X10304)>0,LLVBARS(IF(L10304,LOW,10000),X10304));
G10304:=F10304>REF(F10304,1);
I10304:=BACKSET(G10304,2);
LD0304:=I10304>REF(I10304,1);{过滤后低点}
L20304:=LD0304 OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;
X20304:=REF(BARSLAST(L20304),1)+1;
F2:=BACKSET(L20304 AND COUNT(H20304,X20304)>0,HHVBARS(IF(H20304,HIGH,0),X20304));
G20304:=F2>REF(F2,1); I2:=BACKSET(G20304,2);
HD0304:=I2>REF(I2,1);{过滤后高点}
J1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HD0304),BARSLAST(LD0304))+1);
J2:=J1>REF(J1,1);
A3:=H;
B3:=REF(H,REF(BARSLAST(HD0304),1)+1)>REF(H,REF(BARSLAST(HD0304),1)+2+REF(BARSLAST(HD0304),REF(BARSLAST(HD0304),1)+2));
D3:=A3 AND B3 AND HD0304;
E3:=BACKSET(D3,REF(BARSLAST(HD0304),1)+2);
HH:=E3>REF(E3,1);{找出全部长期高点}
A4:=L>REF(L,REF(BARSLAST(LD0304),1)+1);
B4:=REF(L,REF(BARSLAST(LD0304),1)+1);
D4:=A4 AND B4 AND LD0304;
E4:=BACKSET(D4,REF(BARSLAST(LD0304),1)+2);
LL:=E4>REF(E4,1);{找出全部长期低点}
H3:=HH OR ISLASTBAR OR BARSCOUNT(C)=1; {后面进行过滤,方法同前。只是不用考虑高低点出现在同一K线}
X3:=REF(BARSLAST(H3),1)+1;
F3:=BACKSET(H3 AND COUNT(LL,X3)>0,LLVBARS(IF(LL,L,POW(10,20)),X3));
G3:=F3>REF(F3,1);
I3:=BACKSET(G3,2);
LZ:=I3>REF(I3,1); {长期低点,也可供引用}
L4:=LZ OR ISLASTBAR OR BARSCOUNT(C)=1;
X4:=REF(BARSLAST(L4),1)+1;
F4:=BACKSET(L4 AND COUNT(HH,X4)>0,HHVBARS(IF(HH,H,-POW(10,20)),X4));
G4:=F4>REF(F4,1);
I4:=BACKSET(G4,2);
HZ:=I4>REF(I4,1);{长期高点,也可供引用}
K1:=BACKSET(ISLASTBAR,MIN(BARSLAST(HZ),BARSLAST(LZ))+1);
K2:=K1>REF(K1,1);
UU:=BACKSET(ISLASTBAR,BARSLAST(LD0304)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD0304),1)+2);
XX:=WW>REF(WW,1);
UU2:=BACKSET(ISLASTBAR,BARSLAST(HD0304)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD0304),1)+2);
XX20304:=WW2>REF(WW2,1);
前一低:=REF(L,BARSLAST(VV)),COLOR99FF66,LINETHICK2;
前二低:=REF(L,BARSLAST(XX)),COLORFF66FF,LINETHICK2;
前一高:=REF(H,BARSLAST(VV2)),COLOR99FF66,LINETHICK2;
前二高:=REF(H,BARSLAST(XX20304)),COLORFF66FF,LINETHICK2;
短高:=REF(H,BARSLAST(VV2));短低:=REF(L,BARSLAST(VV));
短比:=(C-短低)/(短高-短低),NODRAW;{以下语句为三角形部分}
底:REF(L,BARSLAST(VV)),COLORRED,LINETHICK2;
顶:REF(H,BARSLAST(VV2)),COLORGREEN,LINETHICK2;
{下迭三角形}
STICKLINE(VV,顶,底,0,0),COLORFF6633,LINETHICK3;
DRAWLINE(VV2,H,VV,L,0),COLORBLUE,LINETHICK3;{斜}
DRAWLINE(VV2,H,VV,顶,0),COLORFF6633,LINETHICK3;{顶}
DRAWTEXT(ISLASTBAR,顶,STRCAT((''),CON2STR(顶,2))),COLORGREEN;
DRAWTEXT(ISLASTBAR,底,STRCAT((''),CON2STR(底,2))),COLORRED;
{上涨三角形}
STICKLINE(VV2 ,顶,底,0,0),COLORRED,LINETHICK3;
DRAWLINE(VV,L,VV2,H,0),COLORRED,LINETHICK3;{斜}
DRAWLINE(VV,L,VV2,底,0),COLORRED,LINETHICK3;
突破:=CROSS(C,顶);
STICKLINE(突破,O,C,2,0),COLOR0099FF;
MAA5:MA(C,5),COLORFF00FF,LINETHICK2;
MAA10:=MA(C,10);
MAA30:MA(C,30),COLORRED;
KS:IF(MAA10>MAA30,MAA10,MAA30),COLORBLUE;
AA3:=(C-LLV(L,9))/(HHV(H,9)-LLV(L,9))*100;
AA4:=SMA(AA3,3,1);
A5:=SMA(A4,3,1);
A6:=3*AA4-2*A5;
A7:=C-REF(C,1);
A8:=100*EMA(EMA(A7,6),6)/EMA(EMA(ABS(A7),6),6);
买:=LLV(A8,2)=LLV(A8,7) AND COUNT(A8<0,2) AND CROSS(A8,MA(A8,2));
STICKLINE(买,OPEN,CLOSE,2,0),COLORYELLOW;
YLX:DRAWLINE(H>=HHV(H,20),H,L<=LLV(L,5),HHV(H,5),1),COLORLIRED;
TJ:=CROSS(C,YLX);
DRAWICON(TJ,L*0.98,1),DRAWABOVE;

上一篇:通达信公式下载:地量启涨+趋势黑马

下一篇:通达信公式下载:资金监控+狼成交 资金流量