这个公式没什么特别就是K线也参与波段变化,目的只有一个不叫你坐过山车,图面再清楚不过了.
公式原理就是所谓【神奇线】和BOLL以及K线,三者合起来告诉你波段的开始和结束,既然源码已发表,多说无益。请君自便,当然你怎么改都行,【小牛】图已发过,看我贴的都知道,不再发了;
{心悦诚服E}
input:n(26,5,300),p(2,0.1,10);
STICKLINE(OPEN<CLOSE ,H ,L,0.5,0 ),COLOR0000FF,LAYER3;
STICKLINE(OPEN<CLOSE ,CLOSE ,OPEN,8,0 ),COLOR0022FF,LAYER6;
STICKLINE(OPEN<CLOSE ,CLOSE ,OPEN,5,0 ),COLOR0598DD,LAYER3;
STICKLINE(OPEN>=CLOSE ,H ,L,0.5,0 ),COLOR00FF00,LAYER3;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,8,0 ),COLOR00FF00,LAYER6;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,5,0 ),COLORff0000,LAYER3;
{1.BBI}
BBI:=(2*c+H+L)/4;
{2.BOLL}
MID : MA(BBI,N) ,COLOR00ff00,DOTLINE;
UPPER: MID + P*STD(BBI,N) ,COLOR0000FF,DOTLINE;
LOWER: MID - P*STD(BBI,N) ,COLOR00FFff,DOTLINE;
{3.持股}
A:(8*BBI+7*REF(BBI,1)+6*REF(BBI,2)+5*REF(BBI,3)+4*REF(BBI,4)+3*REF(BBI,5)+2*REF(BBI,6)
+1*REF(BBI,7))/36,COLOR00ffFF,LINETHICK1;
B:=REF(MEMA(A,5),3);
CG:=(A-B);
X:=BARSLAST(DISPSTATUS=1)+1;
E:=llvall(llv(l,x))*0.95;
STICKLINE(CG>=0 ,E+(CG)*2,E,12,0),Color0000FF,LAYER3;
STICKLINE(CG<0 ,E+(CG)*2,E,12,0),ColorFF9900,LAYER3;
DRAWGBK(CG>0 ,STRIP(RGB(0,0,255),RGB(140,0,100),0)),LAYER0;
FILLRGN(UPPER,MID,UPPER>MID AND CG>0 AND MA(C,2)> MID,RGB(80,0,80)),LAYER5;
FILLRGN(UPPER,LOWER,UPPER>LOWER ,RGB(0,80,0)),LAYER7;
AL:=LLV(CG,A);
FL:=FILTER(CROSS(CG,AL),5);
drawbmp(FL AND CG<0 ,AL+E,'小牛.bmp'),align1,valign0,LAYER0;
{4.画线}
PARTLINE(UPPER ,UPPER and CG>0 AND MA(C,2)> MID,rgb(255,120,0)),LINETHICK3,LAYER0;
PARTLINE(MID ,MID and CG>0 AND MA(C,2)> MID,rgb(0,255,0)),LINETHICK3,LAYER0;
VERTLINE(CROSS(REF(EMA(BBI,20),1),EMA(BBI,20)) AND CG>0 ,2),LAYER0,COLOR00FFff;
{5.别坐过山车}
PK:=CROSS(0,CG) AND CG<0 AND MA(C,5)>MID;
DRAWTEXT(PK,LOWER*0.999,'●'),LAYER3,ALIGN1,COLOR0000FF,LINETHICK2;
DRAWTEXT(PK,LOWER*0.981,'【别】'),LAYER0,ALIGN1,COLOR00FFFF,LINETHICK1;
DRAWTEXT(PK,LOWER*0.963,'【坐】'),LAYER0,ALIGN1,COLOR00FFCC,LINETHICK1;
DRAWTEXT(PK,LOWER*0.946,'【过】'),LAYER0,ALIGN1,COLOR00FFAA,LINETHICK1;
DRAWTEXT(PK,LOWER*0.929,'【山】'),LAYER0,ALIGN1,COLOR00FF77,LINETHICK1;
DRAWTEXT(PK,LOWER*0.912,'【车】'),LAYER0,ALIGN1,COLOR00FF00,LINETHICK1;
{K线}
STICKLINE(CLOSE>OPEN and CG>=0,HIGH,LOW,0.5,0 ),COLOR0000FF;
STICKLINE(OPEN>=CLOSE and CG>=0,HIGH,LOW,0.5 ,0 ),COLOR00FF00;
STICKLINE(OPEN>=CLOSE and CG>=0 ,CLOSE ,OPEN,9,0 ),COLOR006600;
STICKLINE(OPEN>=CLOSE and CG>=0 ,CLOSE ,OPEN,7,0 ),COLOR009900;
STICKLINE(OPEN>=CLOSE and CG>=0 ,CLOSE ,OPEN,5,0 ),COLOR00BB00;
STICKLINE(OPEN>=CLOSE and CG>=0 ,CLOSE ,OPEN,3,0 ),COLOR00DD00;
STICKLINE(OPEN>=CLOSE and CG>=0 ,CLOSE ,OPEN,1,0 ),COLOR00FF00;
STICKLINE(CLOSE>OPEN and CG>=0,CLOSE,OPEN,9,0) ,COLOR000466;
STICKLINE(CLOSE>OPEN and CG>=0,CLOSE,OPEN,7,0) ,COLOR000499;
STICKLINE(CLOSE>OPEN and CG>=0,CLOSE,OPEN,5,0) ,COLOR0003bb;
STICKLINE(CLOSE>OPEN and CG>=0,CLOSE,OPEN,3,0) ,COLOR0002dd;
STICKLINE(CLOSE>OPEN and CG>=0,CLOSE,OPEN,1,0) ,COLOR0001ff;
副图源码:--【黄线】可移动,[N]累计天数可变,
{心悦诚服D}
input:N(7,1,72),B(7,0,500);0,DOTLINE;
DRAWGBKlast(DATE>900101,strip(RGB(0,30,0),RGB(0,0,20),0));
JGMR:=BIGORDER(1,3);
JGMC:=BIGORDER(2,3);
DHMR:=(BIGORDER(1,2)-BIGORDER(1,3));
DHMC:=(BIGORDER(2,2)-BIGORDER(2,3));
ZHMR:=(BIGORDER(1,1)-BIGORDER(1,2));
ZHMC:=(BIGORDER(2,1)-BIGORDER(2,2));
SHMR:=(1-BIGORDER(1,1));
SHMC:=(1-BIGORDER(2,1));
JGDX:=(JGMR-JGMC)*100;
DHDX:=(DHMR-DHMC)*100;
ZHDX:=(ZHMR-ZHMC)*100;
SHDX:=(SHMR-SHMC)*100;
(JGDX+DHDX),LINETHICK0;
龙虎S:SUM((SHDX),N),Color00FF00,DOTLINE;
STICKLINE((JGDX+DHDX)<0,(JGDX+DHDX),0,6,0),COLORFF8800;
STICKLINE((JGDX+DHDX)<0,(JGDX+DHDX),0,4,0),COLORFFaa00;
STICKLINE((JGDX+DHDX)<0,(JGDX+DHDX),0,2,0),COLORFFcc00;
STICKLINE((JGDX+DHDX)<0,(JGDX+DHDX),0,1,0),COLORFFee00;
STICKLINE((JGDX+DHDX)>=0,(JGDX+DHDX),0,6,0),COLOR880088;
STICKLINE((JGDX+DHDX)>=0,(JGDX+DHDX),0,4,0),COLORaa00aa;
STICKLINE((JGDX+DHDX)>=0,(JGDX+DHDX),0,2,0),COLORcc00CC;
STICKLINE((JGDX+DHDX)>=0,(JGDX+DHDX),0,1,0),COLORee00ee;
RSV:SUM((JGDX+DHDX),N),LINETHICK0;
K:=SMA(RSV,3,1);
D:=SMA(K,9,1);
Var1:3*K-2*D,Color00FF00,LINETHICK1;
走向升:if(Var1>REF(Var1,1),1,0),LINETHICK0,PRECIS0;
PARTLINE(Var1,Var1> (REF(Var1,1)),RGB(255,60,0)),linethick3,colorRed,LAYER2;
if(Var1>=0,Var1*0.9,0),COLOREEFFFF;
if(Var1>=0,Var1*0.8,0),COLOREEEEFF;
if(Var1>=0,Var1*0.7,0),COLORDDDDFF;
if(Var1>=0,Var1*0.6,0),COLORBBBBFF;
if(Var1>=0,Var1*0.5,0),COLORAAAAFF;
if(Var1>=0,Var1*0.4,0),COLOR9999FF;
if(Var1>=0,Var1*0.3,0),COLOR8888FF;
if(Var1>=0,Var1*0.2,0),COLOR7777FF;
if(Var1>=0,Var1*0.1,0),COLOR6666FF;
if(Var1<0,Var1*0.9,0),COLORFFD0D0;
if(Var1<0,Var1*0.8,0),COLORFFB0B0;
if(Var1<0,Var1*0.7,0),COLORFF9D9D;
if(Var1<0,Var1*0.6,0),COLORFF8E8E;
if(Var1<0,Var1*0.5,0),COLORFF7D7D;
if(Var1<0,Var1*0.4,0),COLORFF6A6A;
if(Var1<0,Var1*0.3,0),COLORFF4D4D;
if(Var1<0,Var1*0.2,0),COLORFF2D2D;
if(Var1<0,Var1*0.1,0),COLORFF0000;
0;
走向降:if(Var1<REF(Var1,1),-1,0),LINETHICK0,PRECIS0;
走转升:if(Var1>REF(Var1,1) AND REF(Var1,1)<REF(Var1,2),1,0),LINETHICK0;
走转降:if(Var1<REF(Var1,1) AND REF(Var1,1)>REF(Var1,2),-1,0),LINETHICK0;
连续飘红3天:last((JGDX+DHDX)>0)>3,PRECIS0;
红3天:if(连续飘红3天,20,0);
FILLRGN( 0,红3天),ColorFF0074,LAYER7;;
龙虎:(BIGORDER(1,2)-BIGORDER(2,2))*vol/capital*100,COLOR3D;
DRAWTEXTREL(10,2,'今天:■DDX:'+NUMTOSTRN(龙虎,3)+'%'),Color00FFff,LINETHICK1;
{B线}
X:=BARSLAST(DISPSTATUS=1)+1;
HX:=HHVALL(X);
GX:=(HX- X)+1 ;
VERTLINE(GX=B+1,2),Color00FFFF;
SXB:SUM(龙虎,B+1);
DRAWTEXT(GX=B+1 ,50,' 当天: '+NUMTOSTRN(龙虎,3)+''),ALIGN0,color00ff00,LAYER0,LINETHICK2;
VAR18gB:=IF(DISPSTATUS=2,SXB,0);
VAR19gB:=IF(HHVALL(VAR18gB) > 0,HHVALL(VAR18gB),LLVALL(VAR18gB));
DRAWTEXT(GX=B+1,60,'【'+(GX)+'天】DDX累计:'+NUMTOSTRN(VAR19gB,3)+''),LAYER0,ALIGN2,COLOR0077FF,LINETHICK2;
DRAWTEXT(GX=B+1,80,'【'+(GX)+'天】DDX累计:'+NUMTOSTRN(VAR19gB/vol*capital/100* AMOUNT/10000,1)+'万'),ALIGN2,ColoR00FFff,LINETHICK4;
{BBI:=(2*C+H+L+O/2)/4.5;
心悦:EMA(((SLOPE(BBI,18)*27)+BBI),45),COLORFF9900,LINETHICK0;
DRAWGBK(心悦>ref(心悦,1),STRIP(RGB(0,0,255),RGB(140,0,80),0)),LAYER0;}
DIFF :EMA( EMA(CLOSE,12) - EMA(CLOSE,26),3),COLOR0000FF,LINETHICK0;
DEA : EMA(DIFF,9),COLOR00FF00,LINETHICK0;
MACD : 2*(DIFF-DEA),LINETHICK0;
DRAWGBK(DIFF>DEA,STRIP(RGB(0,0,255),RGB(140,0,80),0)),LAYER0;
|