【通達(dá)信】MACD+KDJ指標(biāo)公式
攻城獅 2016.02.03 19:25
A:=CURRBARSCOUNT;
A1:=DAY!=REF(DAY,1);
A2:=BARSLAST(A1)+1;
A3:=MA(C,A2);
A4:=SUM(AMO,A2)/SUM(VOL,A2)/100;
A5:=IF(CAPITAL>0,A4,A3);
均價線:=IF(A<=CONST(A2),A5,DRAWNULL);
分鐘有效周期:=IF(PERIOD=2,15,IF(PERIOD=3,30,IF(PERIOD=4,60,IF(PERIOD=5,240,DRAWNULL))));
分時價:=TFILT(CLOSE,CURRBARSCOUNT,00,CURRBARSCOUNT,00);
分時判斷:=IF(分時價=DRAWNULL,1,IF(分鐘有效周期=DRAWNULL,DRAWNULL,1));
{—————————–由MACD定位頂?shù)?#8212;—————————-}
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
KX:=BARSSINCE(CLOSE);{←首次開盤價距金的天數(shù)}
HHN:=CONST(HHV(DIFF,KX));
HLN:=CONST(LLV(DEA,KX));
RC1:=CONST((HHN+HLN)/2);
SS:=((HHN-HLN)/200);
MACD底部:=(-100*SS+RC1)+-(-100*SS+RC1),COLOR669999;
MACD頂部:=(100*SS+RC1)+-(-100*SS+RC1),COLORFF0033;
MACD中軸:=0+-(-100*SS+RC1);
DIFF修正:=DIFF+-(-100*SS+RC1),COLOR008080;
DEA修正:=DEA+-(-100*SS+RC1),COLOR00FF00;
MACD修正:=2*(DIFF修正-DEA修正)+MACD中軸,COLOR0000BB,NODRAW;
MACD超跌:=CONST(LLV(MACD修正,KX));
MACD超跌線:=IF(MACD超跌{———————-利用MACD趨勢進(jìn)行精確頂?shù)着袛?#8212;———————}
頂部:=MACD頂部+-MACD超跌線;
天際:=頂部*0.809;
中軸:=MACD中軸+-MACD超跌線;
海面:=頂部*0.191;
底部:=MACD底部;
{————————傳統(tǒng)KDJ指標(biāo)結(jié)合MACD優(yōu)化—————————}
RSVA:=(CLOSE-LLV(LOW,21))/(HHV(HIGH,21)-LLV(LOW,21))*頂部;{采用21日月線優(yōu)化}
K:SMA(RSVA,3,1),COLORFFFFFF,NODRAW;
D:SMA(K,3,1),COLOR00FFFF,NODRAW;
原J值參數(shù):=3*K-2*D;
JD:=IF(原J值參數(shù)<底部,底部,原J值參數(shù));{J值底部鈍化處理}
J:IF(JD>頂部,頂部,JD),COLORFF00FF,NODRAW;{底部鈍化處理后再進(jìn)行頂部鈍化處理}
{—————————MACD多空量能判斷——————————-}
MACD多頭:DIFF修正+-MACD超跌線,COLOR339999;
空頭:DEA修正+-MACD超跌線,COLOR00FF00;
量能柱:2*(MACD多頭-空頭)+中軸,COLOR0000BB,NODRAW;
超前DEA:=(EMA(MACD多頭,7));
超前MACD:=2*(MACD多頭-超前DEA)+中軸;
{———————————–大盤動向——————————-}
VAR1大盤:=LLV(LOW,13);
VAR2大盤:=HHV(HIGH,13);
VAR3大盤:=(SMA((CLOSE-VAR1大盤)/(VAR2大盤-VAR1大盤)*頂部,5,1))-頂部/2;
VAR4大盤:=SMA((VAR2大盤-CLOSE)/(VAR2大盤-VAR1大盤)*頂部,5,1)-頂部/2;
大盤散戶:=IF(VAR4大盤<底部,底部,VAR4大盤),COLOR408000;
大盤主力:=IF(VAR3大盤<底部,底部,VAR3大盤),COLOR330088;
{———————————密集成本突破—————————–}
最高獲利參數(shù):=頂部/100;
VAR1C:=(COST(89)-COST(11))*最高獲利參數(shù);
VAR2C:=(COST(99.9)-COST(1))*最高獲利參數(shù);
單峰:=((1-VAR1C/VAR2C))*頂部;
低密:=((COST(90)-COST(60))/VAR2C)*頂部;
高密:=((COST(40)-COST(1))/VAR2C)*頂部;
贏利:= (SMA(WINNER(AMOUNT/VOL/99),2,1))*頂部;
活躍度:頂部-頂部/(1+EXPMA(HSL,21)),COLOR774455;{←CYF公眾追漲熱情指標(biāo)}
70%成本集中度:=IF(VAR1C>頂部,頂部,VAR1C),COLORFFFFFF;
90%成本集中度:=IF(VAR2C>頂部,頂部,VAR2C),COLORFF0000;
套牢籌碼上升:=IF((單峰-贏利)>底部,(單峰-贏利),底部);
個股散戶:=IF(套牢籌碼上升>頂部,頂部,套牢籌碼上升),COLOR408000;
散戶:IF(個股散戶=DRAWNULL,DRAWNULL,個股散戶),COLOR408000;
獲利籌碼上升:=IF((贏利-單峰)>底部,(贏利-單峰),底部);
個股主力:=IF(獲利籌碼上升>頂部,頂部,獲利籌碼上升),COLOR330088;
主力:IF(個股主力=DRAWNULL,DRAWNULL,個股主力),COLOR330088;
{——————–換手率,五日換手率輔助判斷個股活躍度——————-}
換手:SUM(VOL,1)/CAPITAL*100,COLOR666666,NODRAW;
⑤日換:SUM(VOL,5)/CAPITAL*100,COLOR999999,NODRAW;
{———————-密集成本突破指標(biāo)籌碼峰畫線————————–}
金色背景修邊1:STICKLINE(C>0 AND CURRBARSCOUNT>=2,頂部,底部,3.05,0),COLOR003333;
金色背景修邊2:STICKLINE(C>0 AND CURRBARSCOUNT>=2,頂部,中軸,3.05,0),COLOR003333;
金色背景補(bǔ)充:DRAWBAND(頂部,RGB(51,51,0),中軸,RGB(51,51,0));
金色背景:DRAWBAND(頂部,RGB(51,51,0),底部,RGB(128,128,128));
追漲熱度峰紫色:DRAWBAND(活躍度,RGB(66,52,81),底部,RGB(204,0,0));
高密峰墨藍(lán)色:=DRAWBAND(高密,RGB(0,0,51),底部,RGB(0,0,255));
低密峰純藍(lán)色:=DRAWBAND(低密,RGB(0,0,102),底部,RGB(0,0,255));
90%成本峰:DRAWBAND(90%成本集中度,RGB(0,0,153),底部,RGB(0,0,153));
70%成本峰:DRAWBAND(70%成本集中度,RGB(0,128,0),底部,RGB(255,255,255));
散戶峰綠色:DRAWBAND(散戶,RGB(0,64,0),底部,RGB(204,0,0));
主力峰紅色:DRAWBAND(主力,RGB(102,26,51),底部,RGB(0,0,255));
MACD多空趨勢:DRAWBAND(MACD多頭,RGB(204,51,51),空頭,RGB(0,179,0));
MACD多頭重畫:DRAWBAND(MACD多頭,RGB(153,153,51),MACD多頭,RGB(153,153,51));
MACD空頭重畫:DRAWBAND(空頭,RGB(0,204,0),空頭,RGB(0,204,0));
{——-的通達(dá)信■新寶塔線■—–原碼———–}
VAR1:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
VAR2:=REF(VAR1,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR3:=REF(VAR2,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR4:=REF(VAR3,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR5:=REF(VAR4,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR6:=REF(VAR5,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR7:=REF(VAR6,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR8:=REF(VAR7,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR9:=REF(VAR8,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARD:=CLOSE VARE:=REF(VARD,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARF:=REF(VARE,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR10:=REF(VARF,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR11:=REF(VAR10,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR12:=REF(VAR11,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR13:=REF(VAR12,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR14:=REF(VAR13,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR15:=REF(VAR14,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR16:=REF(VAR15,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR17:=REF(VAR16,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR18:=REF(VAR17,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
三平底翻金:=(REF(VARD OR VARE OR VARF OR VAR10 OR VAR11 OR VAR12 OR VAR13 OR VAR14 OR VAR15 OR VAR16 OR VAR17 OR VAR18,1))
AND VAR1;
主力啟動線:=MA(V,5),COLORFFFFFF;
主力洗盤線:=MA(V,35),COLOR00FFFF;
資金異動線:=MA(V,135),COLORFF0000;
{—————————-買賣參考————————————–}
出擊:=(CROSS(主力啟動線,資金異動線) OR ((主力洗盤線 > 資金異動線) AND CROSS(主力啟動線,主力洗盤線))),COLORYELLOW;
啟動:=(主力啟動線>REF(主力啟動線,1) AND (CROSS(VOL,主力啟動線) AND (REF(VOL,1) 成立:=三平底翻金 AND (出擊 OR 啟動);
買入提示:=IF(成立=1,海面*0.5,0) AND 分時判斷=1;
{————————頂部線,天際線,海面線,底部線重畫——————-}
頂部線:DRAWBAND(頂部,RGB(51,0,255),頂部,RGB(51,0,255));
天際線:DRAWBAND(天際,RGB(128,64,64),天際,RGB(128,64,64));
海面線:DRAWBAND(海面,RGB(0,153,153),海面,RGB(0,153,153));
{————————超前MACD多空量能柱——————————–}
超前MACD紅柱1:STICKLINE(超前MACD>=中軸,超前MACD,中軸,1.50,0),COLOR226688;
超前MACD紅柱2:STICKLINE(超前MACD>=中軸,超前MACD,中軸,0.95,0),COLOR4488BB;
超前MACD紅柱3:STICKLINE(超前MACD>=中軸,超前MACD,中軸,0.31,0),COLOR55AADD;
超前MACD蘭柱1:STICKLINE(超前MACD<=中軸,超前MACD,中軸,1.50,0),COLOR006600;
超前MACD蘭柱2:STICKLINE(超前MACD<=中軸,超前MACD,中軸,0.95,0),COLOR007700;
超前MACD蘭柱3:STICKLINE(超前MACD<=中軸,超前MACD,中軸,0.31,0),COLOR008800;
{————————–MACD多空量能柱———————————-}
MACD紅柱1:STICKLINE(量能柱>=中軸,量能柱,中軸,1.5,0),COLOR000077;
MACD紅柱2:STICKLINE(量能柱>=中軸,量能柱,中軸,1.1,0),COLOR000088;
MACD紅柱3:STICKLINE(量能柱>=中軸,量能柱,中軸,0.6,0),COLOR000099;
MACD紅柱4:STICKLINE(量能柱>=中軸,量能柱,中軸,0.15,0),COLOR0000AA;
MACD蘭柱1:STICKLINE(量能柱<=中軸,量能柱,中軸,1.5,0),COLORAA6633;
MACD蘭柱2:STICKLINE(量能柱<=中軸,量能柱,中軸,1.1,0),COLORBB7744;
MACD蘭柱3:STICKLINE(量能柱<=中軸,量能柱,中軸,0.6,0),COLORCC8855;
MACD蘭柱4:STICKLINE(量能柱<=中軸,量能柱,中軸,0.15,0),COLORDD9966;
{———中軸線重畫及頂部線,天際線,海面線,底部線,多空線文字說明———–}
中軸線:DRAWBAND(中軸,RGB(128,128,255),中軸,RGB(128,128,255));
頂部線文字:DRAWTEXT(CURRBARSCOUNT=1,頂部*0.98,’ 頂部線’),COLORFF0033;
天際線文字:DRAWTEXT(CURRBARSCOUNT=1,天際*0.98,’ 天際線’),COLOR404080;
海面線文字:DRAWTEXT(CURRBARSCOUNT=1,海面,’ 海面線’),COLOR999900;
底部線文字:DRAWTEXT(CURRBARSCOUNT=1,底部,’ 底部線’),COLOR669999;
中軸線文字:DRAWTEXT(CURRBARSCOUNT=1,中軸,’ 多空線’),COLORFF8080;
{——————————-傳統(tǒng)KDJ指標(biāo)線重畫————————–}
D線重畫:DRAWBAND(D,RGB(255,255,0),D*0.998,RGB(255,255,0));
K線重畫:DRAWBAND(K,RGB(255,255,255),K,RGB(255,255,255));
J線重畫:DRAWBAND(J,RGB(255,0,255),J,RGB(255,0,255));
申明:本文為作者投稿或轉(zhuǎn)載,在概念股網(wǎng) http://www.chiang1015.com/ 上發(fā)表,為其獨(dú)立觀點(diǎn)。不代表本網(wǎng)立場,不代表本網(wǎng)贊同其觀點(diǎn),亦不對其真實(shí)性負(fù)責(zé),投資決策請建立在獨(dú)立思考之上。