基本引用例一
"macd. diff", "macd.dea";
基本格式: 指標(biāo)名稱 語句名稱 。ㄗ⒁猓罕仨氂秒p引號(hào)引上)
加入?yún)?shù)例二
"kdj. k" (9,3,3) ;
基本格式:指標(biāo)名稱 語句名稱 參數(shù) (指標(biāo)名稱和語句名稱之間用隔點(diǎn).隔開)
加入?yún)?shù)例三
周m:"macd. diff #WEEK";
引用周線:指標(biāo)名稱 語句名稱 周函數(shù)。ㄗ⒁猓褐芎瘮(shù)前加#字號(hào))
月K:"kdj.k#MONTH";
引用月線同上,只是換成月函數(shù)。
-
應(yīng)用實(shí)例:主圖 頂底背離
A1:=BARSLAST(ref(cross("macd.diff"(12,26,9),"macd.dea"(12,26,9)),1));
B1:=ref(c,A1+1)>c and ref("macd.diff"(12,26,9),A1+1)<"macd.diff"(12,26,9) and cross("macd.diff"(12,26,9),"macd.dea"(12,26,9));
MACD底背離:STICKLINE(FILTER(B1>0,5),0,0.75,3,0),COLOR00FF00;
DRAWTEXT(FILTER(B1>0,5),0.57,'MACD底背離'),COLOR00FF00;
A2:=BARSLAST(ref(cross("kdj.k"(9,3,3),"kdj.d"(9,3,3)),1));
B2:=ref(c,A2+1)>c and ref("kdj.k"(9,3,3),A2+1)<"kdj.k"(9,3,3) and cross("kdj.k"(9,3,3),"kdj.d"(9,3,3));
KDJ底背離:STICKLINE(FILTER(B2>0,5),0,1,3,0),COLORYELLOW;
DRAWTEXT(FILTER(B2>0,5),0.80,'KDJ底背離'),COLORYELLOW;
A3:=BARSLAST(ref(cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
B3:=ref(c,A3+1)>c and ref("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) and cross("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
RSI底背離:STICKLINE(FILTER(B3>0,5),0,0.5,3,0),COLORFFCC66;
DRAWTEXT(FILTER(B3>0,5),0.25,'RSI底背離'),COLORFFCC66;
DRAWTEXT(FILTER(D1>0,5),1.47,'MACD頂背離'),COLOR0066FF;
C2:=BARSLAST(ref(cross("kdj.d"(9,3,3),"kdj.k"(9,3,3)),1));
D2:=ref(c,C2+1)"kdj.k"(9,3,3) and cross("kdj.d"(9,3,3),"kdj.k"(9,3,3));
KDJ頂背離:STICKLINE(FILTER(D2>0,5),2,1,3,0),COLORRED;
DRAWTEXT(FILTER(D2>0,5),1.2,'KDJ頂背離'),COLORRED;
C3:=BARSLAST(ref(cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
D3:=ref(c,C3+1)"RSI.RSI1"(6,12,24) and cross("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
RSI頂背離:STICKLINE(FILTER(D3>0,5),2,1.5,3,0),COLORFF00FF;
DRAWTEXT(FILTER(D3>0,5),1.75,'RSI頂背離'),COLORFF00FF;
第二部分 逐步增加函數(shù)
以均線為例,主圖:
基本句型
MA5:MA(C,5);
MA10:MA(C,10);
MA30:MA(C,30);
MA60:MA(C,60);
增加顏色(注:在沒有顏色輸出符號(hào)時(shí),系統(tǒng)會(huì)自動(dòng)加上顏色)
MA5:MA(C,5),COLORBLUE;
MA10:MA(C,10),COLORF00FF0;
MA30:MA(C,30),COLORFFFF00;
MA60:MA(C,60),COLORYELLOW;
將10日均線變成小圓圈線
MA5:MA(C,5),COLORBLUE;
MA10:MA(C,10),COLORF00FF0,CIRCLEDOT;
MA30:MA(C,30),COLORFFFF00;
MA60:MA(C,60),COLORYELLOW;
將60日均線加粗
MA5:MA(C,5),COLORBLUE;
MA10:MA(C,10),COLORF00FF0,CIRCLEDOT;
MA30:MA(C,30),COLORFFFF00;
MA60:MA(C,60),COLORYELLOW,LINETHICK3;
在5日均線金叉10日均線處顯示符號(hào)
MA5:MA(C,5),COLORBLUE;
MA10:MA(C,10),COLORF00FF0,CIRCLEDOT;
MA30:MA(C,30),COLORFFFF00;
MA60:MA(C,60),COLORYELLOW,LINETHICK3;
金叉:=CROSS(MA5,MA10);
DRAWICON(金叉,L,1);
DRAWTEXT(金叉,L,'金叉');
STICKLINE(金叉,H,L,6,0); (注:這三種顯示方式用其中一種就行)
30日均線向上時(shí)顯示紅色,否則為綠色
MA5:MA(C,5),COLORBLUE;
MA10:MA(C,10),COLORF00FF0,CIRCLEDOT;
MA30:MA(C,30),COLORFFFF00;
MA60:MA(C,60),COLORYELLOW,LINETHICK3;
金叉:=CROSS(MA5,MA10);
DRAWICON(金叉,L,1);
DRAWTEXT(金叉,L,'金叉');
STICKLINE(金叉,H,L,6,0);
PARTLINE(MA30>=REF(MA30,1),MA30),COLORRED;
PARTLINE(MA30<REF(MA30,1),MA30),COLOR00FF00;
(注:最后兩行為劃分段線,大智慧沒有此項(xiàng)功能,大智慧2和分析家 同花順用下面這行)
PARTLINE(MA30,MA30>=REF(MA30,1),RGB(255,0,0),MA30<REF(MA30,1),RGB(0,255,0),1);
通達(dá)信用下面這兩行:
IF(MA30>=REF(MA30,1),MA30,DRAWNULL),COLORRED;
IF(MA30<REF(MA30,1),MA30,DRAWNULL),COLOR00FF00;
(責(zé)任編輯:張曉軒)