標(biāo)簽:雜談 | 分類:指標(biāo)公式 |
第五講(續(xù))
三背景裝飾
飛狐、分析家股軟能將背景顏色通過漸變顏色函數(shù)裝扮的很漂亮,那么大智慧股軟能做到嗎?能,但做出的背景色雖不如飛狐、分析家平滑漂亮,也能起到裝扮的作用,效果也可以。
在大智慧設(shè)計背景色的原理主要是通過主、副圖的坐標(biāo)用畫柱線函數(shù)STICKLINE或者設(shè)定坐標(biāo)用顏色代碼就可以完成。下面用實例來說明背景色的設(shè)計過程。
一、單色背景色,這是最簡單實用的一種裝飾方法。我們先來設(shè)計一個主圖指標(biāo):
要領(lǐng):1、設(shè)定坐標(biāo):STICKLINE(CLOSE>0,h*9.0,l*0.01,8,0),color7d7f0f;意思是CLOSE>0條件滿足時,在坐標(biāo)h*9.0至坐標(biāo)l*0.01處畫寬度為8的實體柱線(也就是在整個主圖上添色)。
也可以這樣設(shè)定STICKLINE(110,0,110,8,0),color7d7f0f;顯示的是同樣效果。
2、添色的源碼必須在指標(biāo)的頭條位置上,否則會覆蓋均線、K線、文字等圖形。
3、必須另外編制K線,因為背景色會覆蓋系統(tǒng)中的K線圖。
4、可以把背景色分為五檔、十擋或更多,同時注意與你的指標(biāo)的最大值、最小值(也就是坐標(biāo))相匹配,否則會在指標(biāo)中出現(xiàn)背景色殘缺不全的情況。
5、用你喜歡的顏色需要結(jié)合調(diào)色器可隨意自定義自己喜歡的顏色。不過可得有耐心啊!
指標(biāo)示例一:
{多空密碼主圖}
STICKLINE(CLOSE>0,h*9.0,l*0.01,8,0),color7d7f0f;{設(shè)置背景,可以將這句源碼復(fù)制粘貼到任意主圖指標(biāo)的頭條位置上}
Var1:=(3*CLOSE+LOW+OPEN+HIGH)/6;
Var3:=(20*Var1+19*REF(Var1,1)+18*REF(Var1,2)+17*REF(Var1,3)+16*REF(Var1,4)+15*REF
(Var1,5)+14*REF(Var1,6)+13*REF(Var1,7)+12*REF(Var1,8)+11*REF(Var1,9)+10*REF
(Var1,10)+9*REF(Var1,11)+8*REF(Var1,12)+7*REF(Var1,13)+6*REF(Var1,14)+5*REF
(Var1,15)+4*REF(Var1,16)+3*REF(Var1,17)+2*REF(Var1,18)+REF(Var1,20))/221;
Var4:=MA(Var3,78),LINETHICK2;
Var5:=EMA(MA(CLOSE,3),34);
Var6:=MA(Var3,5);
Var7:=MA(Var3,9);
M60:MA(C,60),COLOREEFFFF,CIRCLEDOT;
STICKLINE(Var3>1.005*Var4,Var3,Var4,4,1),COLORYELLOW;
STICKLINE(IF(Var3<Var5,Var3<=1.015*Var4,Var3<=1.005*Var4),Var7,Var4,2,1),COLORffff88;
STICKLINE(Var3>Var6,Var3,Var7,4,1),COLORff88ff;
STICKLINE(IF(Var3<Var6,Var3<=1.015*Var6,Var3<=1.005*Var6),Var3,Var7,3,1),COLORFF6633;
STICKLINE(Var3>Var6,Var3,Var7,4,1),COLOR0000ff;
{下面是柱形K線,如果喜歡這樣的K線,你可以復(fù)制粘貼到任意主圖指標(biāo)里面}
STICKLINE(C>=O,C,O,7,0),COLORRED;
STICKLINE(C>=O,C,O,4,0),COLOR7070ff;
STICKLINE(C>=O,C,O,2,0),COLORYELLOW;
STICKLINE(C>=O,H,L,0,0),COLORYELLOW;
STICKLINE(C<=O,C,O,7,0),COLORFF2020;
STICKLINE(C<=O,C,O,4,0),COLORFF6600;
STICKLINE(C<=O,C,O,2,0),colorffcc66;
STICKLINE(C<=O,H,L,0,0),colorffcc66;
M9:MA(C,9),COLORYELLOW;
生命線: MA(CLOSE,13),COLORYELLOW,LINETHICK2;
牛熊線: (EMA(CLOSE,5)*7+EMA(CLOSE,5)*3)/10,COLORFF00CC,LINETHICK2;
箱頂:MA(REF(HHV(CLOSE,30),1),2);
箱底:MA(REF(LLV(CLOSE,30),1),2);
AA:(MA(C,13)+MA(C,21)+MA(C,34)+MA(C,55))/4,COLORFF00FF;
半年線:ma(close,125),colorffcc66;
指標(biāo)示例二:
{財出水面副圖}
VAR2:=(CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100;
VAR3:=SMA(SMA(VAR2,3,1),3,1)/28.57;
VAR4:=EMA(VAR3,5);
操盤:=3*VAR3-2*VAR4;
A1:=CROSS(操盤,VAR3) AND VAR3<2.1 and c>o;
40,colorred,pointdot;
STICKLINE(c>0,40,22,8,0),colorff8080;{設(shè)置背景,CLOSE>0條件滿足時,在坐標(biāo)40至坐標(biāo)22處設(shè)置寬度為8的蘭色背景}
STICKLINE(c>0,22,4,8,0),color916f87;{設(shè)置背景,CLOSE>0條件滿足時,在坐標(biāo)22至坐標(biāo)4處設(shè)置寬度為8的深紫色背景}
stickline(a1,18,15,28,0),colorred;
stickline(a1,18,18,18,0),colorblue;
stickline(a1,8,8,9,0),colorffff00;
stickline(a1,6,6,4,0),colorffff00;
stickline(a1,10,10,12,0),colorffff00;
stickline(a1,12,12,20,0),colorffff00;
stickline(a1,14,14,24,0),colorffff00;
stickline(a1,16,34,0.1,0),colorc0c0c0;
stickline(a1,33,18,9,0),colorwhite;
drawtext(a1,36,''財出水面''),COLORWHITE;
VarE:=30+(REF(CLOSE,1)-REF(OPEN,1))/REF(OPEN,1)*100/1.5;
VarF:=30+(REF(CLOSE,2)-REF(OPEN,2))/REF(OPEN,2)*100/1.5;
Var10:=CROSS("KDJ.K"(9,3,3),"KDJ.J"(9,3,3)) AND "KDJ.D"(9,3,3)>13;
Var11:=CROSS(REF("KDJ.K"(9,3,3),1),REF("KDJ.J"(9,3,3),1)) AND REF("KDJ.D"(9,3,3),1)>13;
Var12:=CROSS(REF("KDJ.K"(9,3,3),2),REF("KDJ.J"(9,3,3),2)) AND REF("KDJ.D"(9,3,3),2)>12;
Var13:=Var10 OR Var11 OR Var12;
Var14:=REF("BIAS.BIAS2"(6,12,24),1)>2;
Var15:=REF("RSI.RSI1"(6,12,24),1)>(VarE+VarF)/1.8 AND REF("ROC.ROC"(12,6),1)-"ROC.ROC"(12,6)>0 AND Var13 AND Var14;
賣出:=Var15*100/15,color00ff00;
stickline(賣出,18,15,28,0),coloryellow;
stickline(賣出,18,18,18,0),colorblue;
stickline(賣出,8,8,9,0),colorffff00;
stickline(賣出,6,6,4,0),colorffff00;
stickline(賣出,10,10,12,0),colorffff00;
stickline(賣出,12,12,20,0),colorffff00;
stickline(賣出,14,14,24,0),colorffff00;
stickline(賣出,16,28,0.1,0),colorc0c0c0;
stickline(賣出,28,18,9,0),color00ff00;
drawtext(賣出,31,''落袋為安''),COLOR00FF00;
指標(biāo)示例三:
{金叉死叉}
STICKLINE(100,0,100,8,0),colorff0098;{設(shè)置背景,100條件滿足時,在坐標(biāo)100至坐標(biāo)0處設(shè)置寬度為8的紫蘭色背景}
Var1:=EMA(HHV(HIGH,500),21);
Var2:=EMA(HHV(HIGH,250),21);
Var3:=EMA(HHV(HIGH,90),21);
Var4:=EMA(LLV(LOW,500),21);
Var5:=EMA(LLV(LOW,250),21);
Var6:=EMA(LLV(LOW,90),21);
Var7:=EMA((Var4*0.96+Var5*0.96+Var6*0.96+Var1*0.558+Var2*0.558+Var3*0.558)/6,21); Var8:=EMA((Var4*1.25+Var5*1.23+Var6*1.2+Var1*0.55+Var2*0.55+Var3*0.65)/6,21);
Var9:=EMA((Var4*1.3+Var5*1.3+Var6*1.3+Var1*0.68+Var2*0.68+Var3*0.68)/6,21);
VarA:=EMA((Var7*3+Var8*2+Var9)/6*1.738,21);
VarB:=REF(LOW,1);
VarC:=SMA(ABS(LOW-VarB),3,1)/SMA(MAX(LOW-VarB,0),3,1)*100;
VarD:=EMA(IF(CLOSE*1.35<=VarA,VarC*10,VarC/10),3);
VarE:=LLV(LOW,30);
VarF:=HHV(VarD,30);
Var10:=IF(MA(CLOSE,58),1,0);
Var11:=EMA(IF(LOW<=VarE,(VarD+VarF*2)/2,0),3)/618*Var10;
Var12:=IF(Var11>40,10,Var11);
STICKLINE(Var12>8,0,Var12,4,1), , COLORFF00FF;
Var13:=HHV(HIGH,30);
Var14:=LLV(LOW,30);
能量K:EMA((CLOSE-Var14)/(Var13-Var14)*97,5),COLORRED,linethick2;
能量D:EMA((CLOSE-Var14)/(Var13-Var14)*100,15),linethick2,colorff9933;
底部峰:5,pointdot,linethick2,COLORFF00FF;
DRAWTEXT(CROSS(底部峰,能量K),能量d,''●''),COLORWHITE;
DRAWTEXT(CROSS(底部峰,能量K),能量K+15,''底部形成''),COLORWHITE;
大智慧:100,,pointdot,linethick2,color00ccff;
強弱分界:50,pointdot,COLORWHITE;
DRAWTEXT(CROSS(90,能量K),80,''●''),COLOR00FF00;
DRAWTEXT(CROSS(90,能量K),90,''有風(fēng)險''),COLOR00FF00;
DRAWTEXT(CROSS(90,能量K),能量K+13,''●''),COLOR00FF00;
DRAWTEXT(CROSS(能量D,能量K),98,''死叉''),COLORFFCC66;
DRAWTEXT(CROSS(能量D,能量K),90,''●''),COLORFFCC66;
DRAWTEXT(CROSS(能量K,能量D),8,''金叉''),COLORYELLOW;
DRAWTEXT(CROSS(能量K,能量D),15,''●''),COLORYELLOW;
0,pointdot,linethick2,COLORFF00FF;
漸變色源碼供參考:
STICKLINE(0 ,0,-1,15,0) ,COLORFF0098;
STICKLINE(10 ,10,0,15,0) ,COLORFF009A;
STICKLINE(20 ,20,10,15,0),COLORFF009C;
STICKLINE(30 ,30,20,15,0),COLORFF009E;
STICKLINE(40 ,40,30,15,0),COLORFF00A0;
STICKLINE(50 ,50,40,15,0),COLORFF00A2;
STICKLINE(60 ,60,50,15,0),COLORFF00A4;
STICKLINE(70 ,70,60,15,0),COLORFF00A6;
STICKLINE(80 ,80,70,15,0),COLORFF00A8;
STICKLINE(90 ,90,80,15,0),COLORFF00AA;
STICKLINE(100 ,100,90,15,0),COLORFF00AC;
STICKLINE(110 ,110,100,15,0),COLORFF00AF;
單色源碼供參考:
STICKLINE(CLOSE>0,h*9.0,l*0.01,8,0),color7d7f0f;
K線
STICKLINE(C>=O,C,O,7,0),COLORRED;
STICKLINE(C>=O,C,O,4,0),COLOR7070ff;
STICKLINE(C>=O,C,O,2,0),COLORYELLOW;
STICKLINE(C>=O,H,L,0,0),COLORYELLOW;
STICKLINE(C<=O,C,O,7,0),COLORFF2020;
STICKLINE(C<=O,C,O,4,0),COLORFF6600;
STICKLINE(C<=O,C,O,2,0),colorffcc66;
STICKLINE(C<=O,H,L,0,0),colorffcc66;
副圖背景色源碼供參考:
STICKLINE(100,0,100,8,0),color7d7f0f;{注意指標(biāo)的坐標(biāo),按不同的坐標(biāo)做相應(yīng)的調(diào)整,本例是100的坐標(biāo)。
這些公式只為學(xué)習(xí)函數(shù)用,不做買賣參考。公式中是以分析家為主要對象表述的,時間久遠了,假如不能和現(xiàn)在的軟件配套了,不必強求。
聯(lián)系客服