当前位置:首页 > 通达信 > 正文

【通达信源码分享】精品指标公式-股价关注源码

2023-03-19未知 编 辑:掌上指标


公式源码:
 
DRAWGBK(C>0,RGB(0,150,150),RGB(0,00,100),0,' ',0),LINETHICK2;
 
 
 
窗口显示:=C>REF(C,1)*1.095 AND C=H;
 
T:=BARSLAST(窗口显示);
 
涨停价:REF(C,T)NODRAW;
 
涨停日期:REF(DATE-1000000,T)NODRAW;
 
 
 
STICKLINE(L>REF(H,1),L,REF(H,1),20,1001), COLORYELLOW ;
 
STICKLINE(REF(L,1)>H,REF(L,1),H,20,1001), COLORGREEN ;
 
 
 
TJ01:=C<O AND REFX(C<O,1) AND REFX(C>O,2);
 
DRAWLINE(TJ01,REFX(LLV(L,2),1),REF(TJ01,1),REF(REFX(LLV(L,2),1),1),1)COLORYELLOW,LINETHICK2;
 
DRAWLINE(TJ01,REFX(HHV(C,2),1),REF(TJ01,1),REF(REFX(HHV(C,2),1),1),1)COLORYELLOW,LINETHICK2;
 
{波峰} 
 
TY:=H; 
 
A1:=REF(TY,10)=HHV(TY,2*10+1); B1:=FILTER(A1,10); C1:=BACKSET(B1,10+1); 
 
HD:=FILTER(C1,10); 
 
A2:=REF(TY,10)=LLV(TY,2*10+1); B2:=FILTER(A2,10); C002:=BACKSET(B2,10+1); 
 
LD:=FILTER(C002,10); 
 
波峰:REF(H,BARSLAST(HD)),COLOR00FF00,POINTDOT; 
 
STICKLINE(H,波峰,波峰,8,0),COLORYELLOW,LINETHICK2;
 
 
 
TJ0:=H>MA(C,10) AND H>MA(C,20) AND MA(C,10)>L AND MA(C,20)>L;
 
STICKLINE(TJ0,C,O,1.5,0)COLORYELLOW;
 
TJ1:=H>MA(C,10) AND H>MA(C,20);
 
TJ2:=L<MA(C,10) AND L<MA(C,20);
 
TJA:=TJ1 AND TJ2;
 
CF:=BACKSET(EVERY(TJA,4),4);
 
CFT:=BARSLAST(CROSS(CF=1,0.5));
 
STICKLINE(CFT<=3,C,O,1.5,0)COLORYELLOW;
 
 
 
BDGD:=C=HHV(C,13);
 
GDSJ:=BARSLAST(FILTER(CROSS(0.8,BDGD),2))+1;
 
高点:REF(C,GDSJ),COLORGREEN,LINETHICK2,POINTDOT;
 
突破:CROSS(C,REF(高点,1)),COLOR00FFFF,POINTDOT,LINETHICK0;
 
STICKLINE(GDSJ<=6,高点,高点,8,0),COLORGREEN,LINETHICK2;
 
BDDD:=C=LLV(C,13);
 
DDSJ:=BARSLAST(FILTER(CROSS(0.8,BDDD),2))+1;
 
低点:REF(C,DDSJ),COLORGREEN,POINTDOT,LINETHICK2;
 
STICKLINE(DDSJ<=6,低点,低点,8,0),COLORGREEN,LINETHICK2;
 
AAA:=(REF(CLOSE,1)+REF(CLOSE,2)+OPEN)/3;
 
 
 
前高:DRAWLINE(CURRBARSCOUNT=3,H,REF(CURRBARSCOUNT=3,1),REF(H,1),1),LINETHICK2;
 
 昨收:DRAWLINE(CURRBARSCOUNT=2,C,REF(CURRBARSCOUNT=2,1),REF(C,1),1),LINETHICK2;
 
压力线:DRAWLINE(HIGH>=HHV(HIGH,10),HIGH,LOW<=LLV(LOW,3),HHV(HIGH,3),1),COLOR0055FF,LINETHICK2;
 
DRAWTEXT(压力线,L-0.2,'压力↙'),COLORE8E8E8;
 
股价:=(C-LLV(L,35))/(HHV(H,35)-LLV(L,35))*100;
 
温度:IF(股价<=35,0,股价),NODRAW;
 
量比:=(MA(VOL,5)-LLV(MA(VOL,5),35))/(HHV(MA(VOL,5),35)-LLV(MA(VOL,5),35))*100;
 
量度:=IF(量比<35,0,量比),COLOR558899,LINETHICK2;
 
MA1:=MA(C,3);
 
MA2:=MA(C,5);
 
MA3:=MA(C,7);
 
MA4:=MA(C,14);
 
短线:MA((MA1+MA2+MA3+MA4)/4,5),COLOR00FFFF,LINETHICK0;
 
涨:IF(MA(CLOSE,短线)>REF(MA(CLOSE,短线),1),MA(CLOSE,10),DRAWNULL),COLORRED,LINETHICK3;
 
平:IF(MA(CLOSE,短线)=REF(MA(CLOSE,短线),1),MA(CLOSE,10),DRAWNULL),COLOR00FFFF,LINETHICK3;
 
跌:IF(MA(CLOSE,短线)<REF(MA(CLOSE,短线),1),MA(CLOSE,10),DRAWNULL),COLORGREEN,LINETHICK3;
 
DRAWTEXT(平=短线,短线*0.998-0.01,'关注'),COLORCYAN;
 
套牢盘%:=100*(1-WINNER(C));
 
获利盘%:=100*WINNER(C);
 
成本90%:=COST(90);
 
成本70%:=COST(70);
 
市场成本:=COST(50);
 
主力成本:=COST(4);
 
 
 
 
 
DRAWTEXT_FIX(C>0,0 ,0.13,0,'套牢盘'),COLOR00FF00;
 
DRAWTEXT_FIX(C>0,0 ,0.19,0,'市场成本'),COLORYELLOW;
 
DRAWTEXT_FIX(C>0,0 ,0.25,0,'主力成本'),COLOR008FFF;
 
DRAWTEXT_FIX(C>0,0 ,0.31,0,'90%成本'),COLORFFFFBF;
 
DRAWTEXT_FIX(C>0,0 ,0.37,0,'70%成本'),COLORF0F000;
 
 
 
 
 
DRAWNUMBER_FIX(C>0,0.08,0.13,0,CONST(套牢盘%)),COLOR00FF00;
 
DRAWNUMBER_FIX(C>0,0.08,0.19,0,CONST(市场成本)),COLORYELLOW;
 
DRAWNUMBER_FIX(C>0,0.08,0.25,0,CONST(主力成本)),COLOR008FFF;
 
DRAWNUMBER_FIX(C>0,0.08,0.31,0,CONST(成本90%)),COLORFFFFBF;
 
DRAWNUMBER_FIX(C>0,0.08,0.37,0,CONST(成本70%)),COLORF0F000;
 
 
 
 
 
MA01:MA(C,1),LINETHICK1;
 
MA20:MA(C,20),COLORE8E8E8,POINTDOT,LINETHICK4;
 
{画方框}
 
LL:=L<REF(L,1) AND L<REFX(L,1);
 
LT:BARSLAST(LL) NODRAW;
 
HH:=L>REF(L,1) AND L>REFX(L,1);
 
TJ:=EVERY(L>REF(L,1),LT) AND HH;
 
HT:BARSLAST(TJ)NODRAW;
 
HHH:=HHV(H,LT+1);
 
AA:DRAWLINE(CROSS(LT=0,0.5) ,L,HT=0 AND LT>2,REF(L,LT),0)COLORYELLOW,LINETHICK2;
 
 
 
三日最低:=EMA((REF(L,4)+REF(L,3)+REF(L,2))/3,3); 
 
三日最高:=EMA((REF(H,4)+REF(H,3)+REF(H,2))/3,3); 
 
EXITLONG:CROSS(CROSS(三日最高,C),0.6);
 
ENTERLONG:CROSS(CROSS(C,三日最低),0.5);
 
STICKLINE(C/REF(C,1)>1.095,C,O,2,0),COLORYELLOW;
 
 
 
涨停:=IF(REF(C,1)*1.095-C<0.01 ,1,0);
 
STICKLINE(涨停,OPEN,CLOSE,2.5,0),COLORYELLOW;
 
DRAWTEXT(涨停,L-0.1,'涨停'),COLORYELLOW;
 
 
 
 
 
 
 
MA5:=MA(C,20);
 
MA6:=MA(C,30);
 
MA7:=MA(C,60);
 
中线:MA((MA5+MA6+MA7)/3,10),COLORFF9999,LINETHICK3;{,COLORWHITE}
 
 
 
DRAWICON(CROSS(短线 ,中线),短线 ,9);
 
DRAWTEXT(CROSS(短线,中线) AND 短线>0,中线-0.05,'牛叉↙'),COLORCYAN;
 
C3:=REF(C,1);
 
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0);
 
STICKLINE(跌停,OPEN,CLOSE,2.5,0),COLORBLUE;
 
DRAWTEXT(跌停,H+0.3,'跌停'),COLORBLUE;
 
NN:=120;
 
{跳空}
 
STICKLINE(REF(L,1)>H,H,REF(L,1),5,0),COLORGRAY;
 
STICKLINE(REF(H,1)<L,L,REF(H,1),5,0),COLORGRAY;
 
{彩色K线}
 
 TYX3:=MA(REF(HHV((C+L+O+H)/4,30),1),3);
 
 TYX4:=MA((C+L+O+H)/4,13);
 
 TYX5:=EMA((C+L+O+H)/4,21);
 
 {空心红}
 
 STICKLINE(C<TYX5 AND C>O,H,L,0,0),COLORRED;
 
 STICKLINE(C<TYX5 AND C>O,C,O,3,1),COLORRED;
 
 {深绿}
 
 STICKLINE(C<TYX5 AND C<O,H,L,0,0),COLOR007700;
 
 STICKLINE(C<TYX5 AND C<O,C,O,3,0),COLOR005500;
 
 STICKLINE(C<TYX5 AND C<O,C,O,2,0),COLOR006600;
 
 STICKLINE(C<TYX5 AND C<O,C,O,1,0),COLOR007700;
 
 {蓝}
 
 STICKLINE(C>TYX5 AND C<O,H,L,0,0),COLORFFDD44;
 
 STICKLINE(C>TYX5 AND C<O,C,O,3,0 ),COLORFF7700;
 
 STICKLINE(C>TYX5 AND C<O,C,O,2,0 ),COLORFFAA22;
 
 STICKLINE(C>TYX5 AND C<O,C,O,1 ,0 ),COLORFFDD44;
 
 {黄}
 
 STICKLINE(C>TYX5 AND C>O,H,L,0,0 ),COLOR00EEFF;
 
 STICKLINE(C>TYX5 AND C>O,C,O,3,0 ),COLOR00AAFF;
 
 STICKLINE(C>TYX5 AND C>O,C,O,2,0 ),COLOR00CCFF;
 
 STICKLINE(C>TYX5 AND C>O,C,O,1,0 ),COLOR00EEFF;
 
 {粉红}
 
 STICKLINE(C>TYX4 AND C>O,H,L,0,0),COLORFF66AA;
 
 STICKLINE(C>TYX4 AND C>O,C,O,3,0 ),COLORFF11FF;
 
 STICKLINE(C>TYX4 AND C>O,C,O,2,0 ),COLORFF44FF;
 
 STICKLINE(C>TYX4 AND C>O,C,O,1,0 ),COLORFF66FF;
 
 {亮灰}
 
 STICKLINE(C>TYX4 AND C<O,H,L,0,0),COLOR999999;
 
 STICKLINE(C>TYX4 AND C<O,C,O,3,0),COLOR555555;
 
 STICKLINE(C>TYX4 AND C<O,C,O,2,0),COLOR777777;
 
 STICKLINE(C>TYX4 AND C<O,C,O,1,0),COLOR999999;
 
 {深红}
 
 STICKLINE(C>TYX3 AND C>O,H,L,0,0),COLOR0000DD;
 
 STICKLINE(C>TYX3 AND C>O,C,O,3,0),COLOR000099;
 
 STICKLINE(C>TYX3 AND C>O,C,O,2,0),COLOR0000BB;
 
 STICKLINE(C>TYX3 AND C>O,C,O,1,0),COLOR0000DD;
 
 {涨跌停K线}
 
 STICKLINE((C-REF(C,1))*100/REF(C,1)>=(10-0.01*100/REF(C,1)),OPEN,CLOSE,1,0),COLORYELLOW;
 
 STICKLINE((REF(C,1)-C)*100/REF(C,1)>=(10-0.01*100/REF(C,1)),OPEN,CLOSE,1,0),COLORWHITE;
 
 {突破}
 
 STICKLINE(REF(COUNT(C<TYX3,5)=5,1) AND C>TYX3 AND C>O,C,O,1,0),COLOR00CCFF;
 
 STICKLINE(REF(COUNT(C<TYX3,5)=5,1) AND C>TYX3 AND C>O,C,O,1,0),COLOR00CCFF;
 
 
 
{红绿三角【副图】}
 
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 BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
 
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 BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
 
X20304:=REF(BARSLAST(L20304),1)+1; 
 
F20304:=BACKSET(L20304 AND COUNT(H10304,X20304)>0,HHVBARS(IF(H10304,HIGH,0),X20304));
 
G20304:=F20304>REF(F20304,1); 
 
I20304:=BACKSET(G20304,2); 
 
HD0304:=I20304>REF(I20304,1);{过滤后高点}
 
UU0304:=BACKSET(BARSTATUS=2,BARSLAST(LD0304)+1);
 
VV0304:=UU0304>REF(UU0304,1);
 
UU20304:=BACKSET(BARSTATUS=2,BARSLAST(HD0304)+1);
 
VV20304:=UU20304>REF(UU20304,1);
 
 
 
{以下语句为三角形部分}
 
底:REF(L,BARSLAST(VV0304)),COLORYELLOW,LINETHICK0; 
 
顶:REF(H,BARSLAST(VV20304)),COLORYELLOW,LINETHICK0;
 
{下跌三角形:绿色三角形画完介入}
 
STICKLINE(VV0304,顶,底,0,0),COLORGREEN,LINETHICK2;
 
DRAWLINE(VV20304,H,VV0304,L,0),COLORGREEN,LINETHICK2;{斜}
 
DRAWLINE(VV20304,H,VV0304,顶,0),COLORGREEN,LINETHICK2;
 
{上涨三角形:红色三角形画完出局}
 
STICKLINE(VV20304 ,顶,底,0,0),COLORBLUE,LINETHICK2;
 
DRAWLINE(VV0304,L,VV20304,H,0),COLORBLUE,LINETHICK2;{斜}
 
DRAWLINE(VV0304,L,VV20304,底,0),COLORBLUE,LINETHICK2;
 
 
 
DRAWICON(C<O AND C>REF(C,1),H,6);{假阴真阳}
 
均价:AMOUNT/VOL/100,NODRAW;
 
假阴0:=O>C AND 均价>REF(C,1);
 
DRAWTEXT(假阴0,L-0.2,'↖假阴真阳'),COLORE8E8E8;
 
STICKLINE(假阴0,O,C,1,0),COLORRED; 
 
 
 
VVOL:=IF(CURRBARSCOUNT=1 AND PERIOD=5,VOL*240/FROMOPEN,DRAWNULL);{模拟量}
 
H_L:=0.1*CONST(HHV(VOL,240));
 
长阴短柱:=C/REF(C,1)<=0.96 AND V<HHV(V,30)/1.9;
 
DRAWTEXT(长阴短柱 ,V+1.6*0.098,'长阴短柱↙'),COLORLICYAN;
 
MA05:=MA(C,5);
 
MA5角度: ATAN((MA05/REF(MA05,1)-1)*100)*180/3.1416,NODRAW;
 
T01:=CONST(LLVBARS(LOW,10));
 
T1HIGH:=CONST(REF(HIGH,T01));
 
MM:=CONST(CURRBARSCOUNT);
 
T02:=CONST(BARSLAST(CURRBARSCOUNT>MM+T01 AND H>T1HIGH));
 
T2HIGH:=CONST(REF(HIGH,T02));
 
T03:=CONST(BARSLAST(CURRBARSCOUNT>MM+T02 AND HIGH>T2HIGH));
 
T3HIGH:=CONST(REF(HIGH,T03));
 
攻击线:DRAWLINE(CURRBARSCOUNT=T03+1, T3HIGH, ISLASTBAR, T3HIGH,1),LINETHICK3,COLOR8080FF;
 
DRAWTEXT(ISLASTBAR, T3HIGH, '必杀攻击线')LINETHICK2,COLORCYAN;
 
 
 
DRAWTEXT_FIX(1,0.07,0,0,HYBLOCK)COLOR0080FF;
 
 
 
{DRAWTEXT_FIX(1,0.01,0.08,0,'主题投资:')COLOR0000FF;
 
DRAWTEXT_FIX(1,0.09,0.08,0,EXTERNSTR(0,1))COLOR0000FF; {低点}
 
{生成数据时第1项输1与这里1一致,描述部分输"主题投资"};
大家都爱看
查看更多热点新闻
点击进入掌上指标资源网-下载各类指标