黄金分割线(指标源码 主图 大智慧 贴图)
大智慧黄金分割线主图指标 源码 贴图
{立体K线}
{红K}
STICKLINE(C>O,C,O,8,0),COLOR000038;
STICKLINE(C>O,C,O,7,0),COLOR000048;
STICKLINE(C>O,C,O,6,0),COLOR000058;
STICKLINE(C>O,C,O,5,0),COLOR000068;
STICKLINE(C>O,C,O,4,0),COLOR000078;
STICKLINE(C>O,C,O,3,0),COLOR000088;
STICKLINE(C>O,C,O,2,0),COLOR000098;
STICKLINE(C>O,C,O,1,0),COLOR0000A8;
STICKLINE(C>O,H,L,0,0),COLOR0008A8;
{绿K}
STICKLINE(C<O,C,O,8,0),COLOR003800;
STICKLINE(C<O,C,O,7,0),COLOR004800;
STICKLINE(C<O,C,O,6,0),COLOR005800;
STICKLINE(C<O,C,O,5,0),COLOR006800;
STICKLINE(C<O,C,O,4,0),COLOR007800;
STICKLINE(C<O,C,O,3,0),COLOR008800;
STICKLINE(C<O,C,O,2,0),COLOR009800;
STICKLINE(C<O,C,O,1,0),COLOR00A800;
STICKLINE(C<O,H,L,0,0),COLOR00A800;
{涨停跌停标示}
C3:=REF(C,1);
涨停:=IF((C-C3)*100/C3>=(10-0.01*100/C3),1,0) or ((STRCMP(STRLEFT(STKNAME,2),'ST')=0 or STRCMP( STRLEFT(STKNAME,3),'*ST')=0) and c>=INTPART(REF(c ,1 )*1.05*100+0.5)/100);
STICKLINE(涨停,OPEN,CLOSE,2.0,0),color00D8D8;
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0) or ((STRCMP(STRLEFT(STKNAME,2),'ST')=0 or STRCMP( STRLEFT(STKNAME,3),'*ST')=0) and (C3-C)*100/C3>=INTPART(REF(c ,1 )*1.05*100+0.5)/100);
STICKLINE(跌停,OPEN,CLOSE,2.0,0),COLOR00EE00;
{涨停跌停标示}
C3:=REF(C,1);
涨停:=IF((C-C3)*100/C3>=(10-0.01*100/C3),1,0) or ((STRCMP(STRLEFT(STKNAME,2),'ST')=0 or STRCMP( STRLEFT(STKNAME,3),'*ST')=0) and c>=INTPART(REF(c ,1 )*1.05*100+0.5)/100);
STICKLINE(涨停,OPEN,CLOSE,2.0,0),color00D8D8;
跌停:=IF((C3-C)*100/C3>=(10-0.01*100/C3),1,0) or ((STRCMP(STRLEFT(STKNAME,2),'ST')=0 or STRCMP( STRLEFT(STKNAME,3),'*ST')=0) and (C3-C)*100/C3>=INTPART(REF(c ,1 )*1.05*100+0.5)/100);
STICKLINE(跌停,OPEN,CLOSE,2.0,0),COLOR00EE00;
{星}
STICKLINE(C=O,C,O,8,0),COLOR888888;
STICKLINE(C=O,H,L,0,0),COLOR888888;
{---------------------------不喜欢立体K线及涨停标识的,以上内容可删除----------------------------------------}
{说明:公式借用理想论坛一品茶缘等老师编写源码而优化,在此表示感谢!!!www.88gs.com}
{黄金分割线}
lhnh:=BARSLAST(DISPSTATUS=1)+1;
nnl:=DISPSTATUS=2;
Al:=BACKSET(nnl,hhvBARS(h,lhnh)+1);
Bl:=Al>REF(Al,1);
Al2:=BACKSET(nnl,LLVBARS(L,lhnh)+1);
Bl2:=Al2>REF(Al2,1);
前高:REF(H,BARSLAST(bl)),PRECIS2,COLOR00A800,LINETHICK1;
DRAWTEXT(nnl,前高*0.995,'前高:'+NUMTOSTRN(前高,2)),ALIGN2,COLOR00A800,PRECIS2;
前低:REF(L,BARSLAST(Bl2)),PRECIS2,COLOR580058,LINETHICK1;
DRAWTEXT(nnl,前低*1.010,'前低: '+NUMTOSTRN(前低,2)),ALIGN2,COLOR380088,PRECIS2;
Fl1:((前高-前低)*0.191)+前低,DOTLINE,Color282828,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl1,'191(809): '+NUMTOSTRN(Fl1,2)),ALIGN2,Color282828;
Fl2:((前高-前低)*0.236)+前低,DOTLINE,Color282828,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl2,'236(764): '+NUMTOSTRN(Fl2,2)),ALIGN2,Color383838;
Fl3:((前高-前低)*0.382)+前低,DOTLINE,Color003838,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl3,'382(618): '+NUMTOSTRN(Fl3,2)),ALIGN2,COLOR003838;
Fl4:((前高-前低)*0.5)+前低,DOTLINE,COLOR383800,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl4,'0.50: '+NUMTOSTRN(Fl4,2)),ALIGN2,Color000058;
Fl5:((前高-前低)*0.618)+前低,DOTLINE,Color003838,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl5,'618(382): '+NUMTOSTRN(Fl5,2)),ALIGN2,COLOR003838;
Fl6:((前高-前低)*0.764)+前低,DOTLINE,Color282828,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl6,'764(236): '+NUMTOSTRN(Fl6,2)),ALIGN2,COLOR383838;
Fl7:((前高-前低)*0.809)+前低,DOTLINE,Color282828,LINETHICK1,PRECIS2;
DRAWTEXT(nnl,Fl7,'809(191): '+NUMTOSTRN(Fl7,2)),ALIGN2,COLOR282828;
A:=BARSLAST(DISPSTATUS=1)+1;
HH:=HHV(H,A);
LL:=LLV(L,A);
上涨:=BARSSINCE(BACKSET(DISPSTATUS=2,BARSLAST(L=LL)+1));
↑空间%:=(C/REF(L,上涨)-1)*100;
最高%:=(HHVALL(HH)/REF(L,上涨)-1)*100;
下跌:=BARSSINCE(BACKSET(DISPSTATUS=2,BARSLAST(H=HH)+1));
↓空间%:=(C/REF(H,下跌)-1)*100;
最低%:=(LLVALL(LL)/REF(H,下跌)-1)*100;
W:=BARSLAST(DISPSTATUS=1);
低涨:=(H/LLV(LOW,W)-1)*100;
高跌:=(L/HHV(HIGH,W)-1)*100;
天日:=BARSLAST(L=LLV(LOW,W));
天:=BARSLAST(H=HHV(HIGH,W));
{以下设置提示文字部分}
DRAWTEXTREL(280,15,'▲低点至今日高点上涨:'+NUMTOSTRN(低涨,2)+'% '+NUMTOSTRN(天日,0)+'天'),COLOR000088,linethick1;
DRAWTEXTREL(128,15,'▼高点至今日低点下跌:'+NUMTOSTRN(高跌,2)+'% '+NUMTOSTRN(天,0)+'天'),COLOR005800,linethick1;
DRAWTEXTREL(018,15,'★目前可见K线数:'+NUMTOSTRN(W+1,0)+'根'),COLOR585858,linethick1;
VERTLINE(上涨=0,2),COLOR380088,LAYER7;
VERTLINE(下跌=0,2),COLOR005800,LAYER7;
{DRAWTEXT(上涨=0,LLVALL(HH)*0.99,'-最高'),COLOR0000D8;
DRAWTEXT(下跌=0,LLVALL(LL)*1.01,'-最低'),COLORD85800;}
DRAWTEXT(上涨=0 AND 最高%>10,LL*1.1,'-10% '+NUMTOSTRN(LL*1.1,2)),COLOR008888;
DRAWTEXT(上涨=0 AND 最高%>20,LL*1.2,'-20% '+NUMTOSTRN(LL*1.2,2)),COLOR005800;
DRAWTEXT(上涨=0 AND 最高%>30,LL*1.3,'-30% '+NUMTOSTRN(LL*1.3,2)),COLOR380088;
DRAWTEXT(上涨=0 AND 最高%>40,LL*1.4,'-40% '+NUMTOSTRN(LL*1.4,2)),COLOR585858;
DRAWTEXT(上涨=0 AND 最高%>50,LL*1.5,'-50% '+NUMTOSTRN(LL*1.5,2)),COLOR580058;
DRAWTEXT(上涨=0 AND 最高%>60,LL*1.6,'-60% '+NUMTOSTRN(LL*1.6,2)),COLOR585800;
DRAWTEXT(上涨=0 AND 最高%>70,LL*1.7,'-70% '+NUMTOSTRN(LL*1.7,2)),COLOR005800;
DRAWTEXT(上涨=0 AND 最高%>80,LL*1.8,'-80% '+NUMTOSTRN(LL*1.8,2)),COLOR005858;
DRAWTEXT(上涨=0 AND 最高%>90,LL*1.9,'-90% '+NUMTOSTRN(LL*1.9,2)),COLOR000058;
DRAWTEXT(上涨=0 AND 最高%>100,LL*2,'-100% '+NUMTOSTRN(LL*2.0,2)),COLOR380088;
DRAWTEXT(上涨=0 AND 最高%>100,LL*2.25,'-125% '+NUMTOSTRN(LL*2.25,2)),COLOR383800;
DRAWTEXT(上涨=0 AND 最高%>150,LL*2.5,'-150% '+NUMTOSTRN(LL*2.5,2)),COLOR585858;
DRAWTEXT(上涨=0 AND 最高%>200,LL*3.0,'-200% '+NUMTOSTRN(LL*3.0,2)),COLOR580058;
DRAWTEXT(上涨=0 AND 最高%>250,LL*3.5,'-250% '+NUMTOSTRN(LL*3.5,2)),COLOR585800;
DRAWTEXT(下跌=0 AND 最低%<-10,HH*0.9,'-10% '+NUMTOSTRN(HH*0.9,2)),COLOR00A800;
DRAWTEXT(下跌=0 AND 最低%<-20,HH*0.8,'-20% '+NUMTOSTRN(HH*0.8,2)),COLORA83800;
DRAWTEXT(下跌=0 AND 最低%<-30,HH*0.7,'-30% '+NUMTOSTRN(HH*0.7,2)),COLOR008800;
DRAWTEXT(下跌=0 AND 最低%<-40,HH*0.6,'-40% '+NUMTOSTRN(HH*0.6,2)),COLOR380088;
DRAWTEXT(下跌=0 AND 最低%<-50,HH*0.5,'-50% '+NUMTOSTRN(HH*0.5,2)),COLOR005858;
DRAWTEXT(下跌=0 AND 最低%<-60,HH*0.4,'-60% '+NUMTOSTRN(HH*0.4,2)),COLOR580058;
DRAWTEXT(下跌=0 AND 最低%<-70,HH*0.3,'-70% '+NUMTOSTRN(HH*0.3,2)),COLOR008800;
DRAWTEXT(下跌=0 AND 最低%<-80,HH*0.2,'-80% '+NUMTOSTRN(HH*0.2,2)),COLORA83800;
DRAWTEXT(下跌=0 AND 最低%<-90,HH*0.1,'-90% '+NUMTOSTRN(HH*0.1,2)),COLOR000088;