虎年送禮:指標(biāo)附圖百分線之通用源碼 目的:將自用指標(biāo)疊加百分線,對(duì)于指標(biāo)的頂?shù)妆畴x等現(xiàn)象 以及指標(biāo)當(dāng)下的強(qiáng)弱狀態(tài)可以一目了然,便于實(shí)戰(zhàn)抉擇。 本人作品,均以簡(jiǎn)潔明了,貼近實(shí)戰(zhàn)為主。 源碼奉出,順祝大家虎年虎虎生風(fēng),財(cái)源廣進(jìn)。 JB:=??;{此句為設(shè)定要點(diǎn),需要畫(huà)線指標(biāo)由此選擇} 貼圖中說(shuō)明如下: 主圖為:JB:=C;---以收盤(pán)為參考,確定波段空間 MACD指標(biāo)為:JB:=DIF; KDJ指標(biāo)為:JB:=J; CCI指標(biāo)為:JB:=CCI;----其余指標(biāo)以此類推。 EE:=CURRBARSCOUNT<=144; HH:=CONST(HHV(JB,144)); LL:=CONST(LLV(JB,144)); 天:=HH,NODRAW,COLORYELLOW; 地:=LL,NODRAW,COLOR00FF00; 強(qiáng):=CONST(HH-(HH-LL)*1/5),NODRAW,COLORFFFF00; 中:=CONST(HH-(HH-LL)*1/2),NODRAW,COLORWHITE; 弱:=CONST(HH-(HH-LL)*4/5),NODRAW,COLOR0099FF;STICKLINE(EE,天,天,10,0),COLORYELLOW; STICKLINE(EE,地,地,1,0),COLOR00FF00; STICKLINE(EE,強(qiáng),強(qiáng),10,0),COLORFFFF00; STICKLINE(EE,中,中,5,0),COLORWHITE; STICKLINE(EE,弱,弱,10,0),COLOR0099FF; 相對(duì):IF(EE,(JB-LL)/(HH-LL)*100,DRAWNULL),NODRAW,COLORFFFF00; |
JB:=dif;{ 疊加在MACD } EE:=CURRBARSCOUNT<=144; HH:=CONST(HHV(JB,144)); LL:=CONST(LLV(JB,144)); 天:=HH,NODRAW,COLORYELLOW; 地:=LL,NODRAW,COLOR00FF00; 強(qiáng):=CONST(HH-(HH-LL)*1/5),NODRAW,COLORFFFF00; 中:=CONST(HH-(HH-LL)*1/2),NODRAW,COLORWHITE; 弱:=CONST(HH-(HH-LL)*4/5),NODRAW,COLOR0099FF;STICKLINE(EE,天,天,10,0),COLORYELLOW; STICKLINE(EE,地,地,1,0),COLOR00FF00; STICKLINE(EE,強(qiáng),強(qiáng),10,0),COLORFFFF00; STICKLINE(EE,中,中,5,0),COLORWHITE; STICKLINE(EE,弱,弱,10,0),COLOR0099FF; 相對(duì):IF(EE,(JB-LL)/(HH-LL)*100,DRAWNULL),NODRAW,COLORFFFF00; ===================================================================== JB:=J;{疊加在KDJ指標(biāo)} EE:=CURRBARSCOUNT<=144; HH:=CONST(HHV(JB,144)); LL:=CONST(LLV(JB,144)); 天:=HH,NODRAW,COLORYELLOW; 地:=LL,NODRAW,COLOR00FF00; 強(qiáng):=CONST(HH-(HH-LL)*1/5),NODRAW,COLORFFFF00; 中:=CONST(HH-(HH-LL)*1/2),NODRAW,COLORWHITE; 弱:=CONST(HH-(HH-LL)*4/5),NODRAW,COLOR0099FF; STICKLINE(EE,天,天,10,0),COLORYELLOW; STICKLINE(EE,地,地,1,0),COLOR00FF00; STICKLINE(EE,強(qiáng),強(qiáng),10,0),COLORFFFF00; STICKLINE(EE,中,中,5,0),COLORWHITE; STICKLINE(EE,弱,弱,10,0),COLOR0099FF; 相對(duì):IF(EE,(JB-LL)/(HH-LL)*100,DRAWNULL),NODRAW,COLORFFFF00; ==================================================================== JB:=CCI;{疊加在CCI指標(biāo)。其余指標(biāo)以此類推} EE:=CURRBARSCOUNT<=144; HH:=CONST(HHV(JB,144)); LL:=CONST(LLV(JB,144)); 天:=HH,NODRAW,COLORYELLOW; 地:=LL,NODRAW,COLOR00FF00; 強(qiáng):=CONST(HH-(HH-LL)*1/5),NODRAW,COLORFFFF00; 中:=CONST(HH-(HH-LL)*1/2),NODRAW,COLORWHITE; 弱:=CONST(HH-(HH-LL)*4/5),NODRAW,COLOR0099FF; STICKLINE(EE,天,天,10,0),COLORYELLOW; STICKLINE(EE,地,地,1,0),COLOR00FF00; STICKLINE(EE,強(qiáng),強(qiáng),10,0),COLORFFFF00; STICKLINE(EE,中,中,5,0),COLORWHITE; STICKLINE(EE,弱,弱,10,0),COLOR0099FF; 相對(duì):IF(EE,(JB-LL)/(HH-LL)*100,DRAWNULL),NODRAW,COLORFFFF00; ==================================================================== |
飛狐版本參考源碼如下,供參考。 =========================================== JB:=diff;{ 疊加在MACD } 高1:=HHV(jb,144); 低1:=LLV(jb,144);天:=高1,linethick0,COLORYELLOW; 地:=低1,linethick0,COLOR00FF00; 強(qiáng):=高1-(高1-低1)*1/5,linethick0,COLORFFFF00; 中:=高1-(高1-低1)*1/2,linethick0,COLORWHITE; 弱:=高1-(高1-低1)*4/5,linethick0,COLOR0099FF; p:=SYSPARAM(1); HhC:=天; LLc:=地; PARTLINE(BARPOS>=p-144,hHC[p]),COLORyellow; DRAWNUMBER(BARPOS=p,hHC[p],hHC[p],2),COLOREEEEEE,PXUP25; PARTLINE(BARPOS>=p-144,LLc[p]),COLOR00ff00; DRAWNUMBER(BARPOS=p,LLc[p],LLc[p],2),COLOREEEEEE,PXUP25; PARTLINE(BARPOS>=p-144,(hHC[p]+LLc[p])/2),COLORwhite; DRAWNUMBER(BARPOS=p,(hHC[p]+LLc[p])/2,(hHC[p]+LLc[p])/2,2),COLOREEEEEE,PXUP25; PARTLINE(BARPOS>=p-144,(hHC[p]*4+LLc[p])/5),COLORffff00; DRAWNUMBER(BARPOS=p,(hHC[p]*4+LLc[p])/5,(hHC[p]*4+LLc[p])/5,2),COLOREEEEEE,PXUP25; PARTLINE(BARPOS>=p-144,(hHC[p]+LLc[p]*4)/5),COLOR0099ff; DRAWNUMBER(BARPOS=p,(hHC[p]+LLc[p]*4)/5,(hHC[p]+LLc[p]*4)/5,2),COLOREEEEEE,PXUP25; 相對(duì):(JB-低1)/(高1-低1)*100,linethick0,COLORFFFF00; =========================================================================== |
將自用的兩套畫(huà)線工具進(jìn)行整合,效果不錯(cuò),供參考。 雙結(jié)構(gòu)畫(huà)線法 以MACD為例: JB:=DIF; EE:=CURRBARSCOUNT<=144; HH:=CONST(HHV(JB,144)); LL:=CONST(LLV(JB,144)); 天:=HH,NODRAW,COLORYELLOW; 地:=LL,NODRAW,COLOR00FF00; 強(qiáng):=CONST(HH-(HH-LL)*1/5),NODRAW,COLORFFFF00; 中:=CONST(HH-(HH-LL)*1/2),NODRAW,COLORWHITE; 弱:=CONST(HH-(HH-LL)*4/5),NODRAW,COLOR0099FF; STICKLINE(EE,天,天,10,0),COLORYELLOW; STICKLINE(EE,地,地,1,0),COLOR00FF00; STICKLINE(EE,強(qiáng),強(qiáng),10,0),COLORFFFF00; STICKLINE(EE,中,中,5,0),COLORWHITE; STICKLINE(EE,弱,弱,10,0),COLOR0099FF; 相對(duì)_:IF(EE,(JB-LL)/(HH-LL)*100,DRAWNULL),NODRAW,COLORFFFF00; OBV:=DIF; P:=5; A1:=REF(OBV,P)=HHV(OBV,2*P+1) AND OBV>0; B1:=FILTER(A1,P); C1:=BACKSET(B1,P+1); D1:=FILTER(C1,P);{高點(diǎn)} A2:=REF(OBV,P)=LLV(OBV,2*P+1) AND OBV<0; B2:=FILTER(A2,P); C2:=BACKSET(B2,P+1); D2:=FILTER(C2,P);{低點(diǎn)} 上:REF(OBV,BARSLAST(D1)),COLORFF00FF,NODRAW; 下:REF(OBV,BARSLAST(D2)),COLOR00FF00,NODRAW;
相對(duì):=(OBV-下)/(上-下)*100,COLORYELLOW,NODRAW; R11:=BACKSET(ISLASTBAR,BARSLAST(D1)+1); S11:=R11>REF(R11,1); DRAWLINE(D1,OBV,S11,OBV,1),COLORYELLOW; T11:=BACKSET(ISLASTBAR,BARSLAST(D2)+1); U11:=T11>REF(T11,1); DRAWLINE(D2,OBV,U11,OBV,1),COLOR00FF00; DRAWTEXT(CROSS(相對(duì),110) ,上,'上'),COLORYELLOW; DRAWTEXT(CROSS(-10,相對(duì)) ,下,'下'),COLORYELLOW; DRAWICON(D1,OBV,1); DRAWICON(D2,OBV,2); ========================================================== |
|