【指标公式源码下载】通达信MACD和KDJ金叉共振选股指标公式

合集下载

通达信MACD和KDJ四周期同框指标公式

通达信MACD和KDJ四周期同框指标公式

通达信MACD和KDJ四周期同框指标公式DIF60:=EMA(CLOSE,12/4)-EMA(CLOSE,26/4);DEA60:=EMA(DIF60,9/2);STICKLINE(DIF60>=DEA60,42,46,2,0),COLORFF5500;STICKLINE(DIF60<DEA60,42,46,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,44,'★60分钟MACD★'),COLORWHITE;DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIF,9);STICKLINE(DIF>=DEA,36,40,2,0),COLOR0000BB;STICKLINE(DIF<DEA,36,40,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,38,'★MACD日线★'),COLOR00FFFF;周MD:=MACD.DIF#WEEK;周MA:=MACD.DEA#WEEK;STICKLINE(周MD>=周MA,30,34,2,0),COLORBB00BB;STICKLINE(周MD<周MA,30,34,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,32,'★MACD周线★'),COLOR00FFFF;月MD:=MACD.DIF#MONTH;月MA:=MACD.DEA#MONTH;STICKLINE(月MD>=月MA,24,28,2,0),COLOR009F00;STICKLINE(月MD<月MA,24,28,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,26,'★月MACD★'),COLORWHITE;RSV60:=(CLOSE-LLV(LOW,36))/(HHV(HIGH,36)-LLV(LOW,36));K60:=SMA(RSV60,3,1);D60:=SMA(K60,3,1);STICKLINE(K60>= D60,18,22,2,0),COLOR00FFFF;STICKLINE(K60 < D60,18,22,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,20,'★60分钟KDJ★ '),COLORFF00FF;RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9));K:=SMA(RSV,3,1);D:=SMA(K,3,1);J:=3*K-2*D;STICKLINE(K>=D,12,16,2,0),COLOR9F9F6F;STICKLINE(K<D,12,16,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,14,'★KDJ日线★'),COLORFFFFFF;周K:="KDJ.K#WEEK" ;周D:="KDJ.D#WEEK" ;STICKLINE(周K>=周D,6,10,2,0),COLOR4D4DFF;STICKLINE(周K<周D,6,10,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,8,'★KDJ周线★'),COLORWHITE;月K:="KDJ.K#MONTH" ;月D:="KDJ.D#MONTH" ;STICKLINE(月K>=月D,0,4,2,0),COLORFF00FF;STICKLINE(月K<月D,0,4,3,1),COLOR696969;DRAWTEXT(CURRBARSCOUNT=13,2,'★KDJ月线★'),COLORWHITE;XG1:=DIF60>=DEA60;XG2:=DIF>=DEA;XG3:=周MD>=周MA;XG4:=月MD>=月MA;XG5:=K60>= D60;XG6:=K>=D;XG7:=周K>=周D;XG8:=月K>=月D;XG9:=XG1 AND XG2 AND XG3 AND XG4 AND XG5 AND XG6 AND XG7 AND XG8;XGE:=XG1 + XG2 + XG3 + XG4 + XG5 + XG6 + XG7 + XG8;STICKLINE(1,48,52,3,1),COLOR696969;DRAWNUMBER(1,52,XGE),COLORLIGRAY;DRAWNUMBER(XGE=8,52,XGE),COLORMAGENTA;XG:REF(XG9,1)<>1 AND XG9=1,NODRAW;STICKLINE(XG,0,46,0,0),COLORRED;。

MACD叠加KDJ通达信指标公式源码

MACD叠加KDJ通达信指标公式源码

MACD叠加KDJ通达信指标公式源码
在通达信指标公式中,MACD(Moving Average Convergence Divergence)是一种常用的技术指标,用于判断价格的趋势性和价格的转折点。

KDJ(KDJ Index)是股票指标中也是非常重要的一种指标,它是根据随机指标RSV(Relative Strength Value)计算得出的。

下面是MACD叠加KDJ的通达信指标公式源码:
1.MACD指标公式源码:
```
计算DIF线(DIF):
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
计算MACD(DIFF与DEA的差值):
MACD:DIF-EMA(DIF,9);
计算MACD的九根平均线(DEA):
DEA:EMA(MACD,9);
计算MACD柱(DIFF与DEA的差值):
MACD柱:2*(DIF-DEA);
```
2.KDJ指标公式源码:
```
计算最近9天内的最低价(N):
LLV:LLV(LOW,9);
计算最近9天内的最高价(H):
HHV:HHV(HIGH,9);
计算未成熟随机指标RSV:
RSV:(CLOSE-LLV)/(HHV-LLV)*100;
计算K值(K):
K:SMA(RSV,3,1);
计算D值(D):
D:SMA(K,3,1);
计算J值(J):
J:3*K-2*D;
```
以上是MACD叠加KDJ的通达信指标公式源码,你可以在通达信软件中使用这些公式来计算指标数值并进行技术分析。

通达信指标公式源码MACD、KDJ、RSI三合一

通达信指标公式源码MACD、KDJ、RSI三合一

通达信指标公式源码MACD、KDJ、RSI三合⼀DIFF:EMA(CLOSE,7) - EMA(CLOSE,19),COLORGREEN;DEA:EMA(DIFF,9),COLORYELLOW;MACD:2*(DIFF-DEA),COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIFF,A1+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)); A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1)); B3:=REF(C,A3+1)>C ANDREF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) ANDCROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));D1:=REF(C,C1+1)DIFF AND CROSS(DEA,DIFF); 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));C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1)); D3:=REF(C,C3+1)REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) ANDCROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));{MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;KDJ底背:IF(B2>0,-0.1,0),COLORFF00FF,POINTDOT;RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;}MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;{STICKLINE(B1>0,-0.1,0,2,0),COLORRED;STICKLINE(B2>0,-0.1,0,2,0),COLORFF00FF;STICKLINE(B3>0,-0.1,0,2,0),COLORYELLOW;}STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;STICKLINE(D2>0,0.1,0,2,0),COLORFFCC66;STICKLINE(D3>0,0.1,0,2,0),COLORWHITE;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORRED; STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORYELLOW;STICKLINE(MACD=REF(MACD,1) ANDMACD<0,0,MACD,0,0),COLORMAGENTA;STICKLINE(C>0,0,0,50,1),COLORBLUE;NOTEXT强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED; NOTEXT弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA; VARA1:=(DVOL/C)/2,NODRAW;VARA2:=SUM(IF(VARA1>100 AND CLOSE>REF(CLOSE,1),VARA1,0),0); VARA3:=SUM(IF(VARA1>100 AND CLOSEREF(CLOSE,1),VARA1,0),0); VARA5:=SUM(IF(VARA1<100 AND CLOSE机买:=(VARA2/VARA6)*100,LINETHICK2,COLORRED;机卖:=(VARA3/VARA6)*100,LINETHICK2,COLORGREEN;主⼒差:=机买-机卖,LINETHICK2,NODRAW;强度:主⼒差-REF(主⼒差,1),NODRAW,COLORYELLOW;STICKLINE(强度>1.5,-0.1,0,2,0),COLORYELLOW;近期:BARSLAST(强度>1.5),NODRAW,COLORGRAY;N:=7{2,100};M:=5{2,100};VAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;B:=SMA(VAR1,N,1);VAR2:=SMA(B,M,1);短买:CROSS(B,VAR2) AND B<40,NODRAW,COLORRED;DRAWICON(短买,0,1);。

【通达信】KDJMACD二合一

【通达信】KDJMACD二合一

【通达信】KDJMACD二合一(顶底判断、大盘动向、成本突破)-指标公式源码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,DRAW NULL))));分时价:=TFILT(CLOSE,CURRBARSCOUNT,00,CURRBARSCOUNT,00);分时判断:=IF(分时价=DRAWNULL,1,IF(分钟有效周期=DRAWNULL,DRAWNULL,1)); {-----------------------------由MACD定位顶底-------------------------------}DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIFF,9);MACD:=2*(DIFF-DEA);KX:=BARSSINCE(CLOSE);{←首次开盘价距金的天数}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底部,MACD超跌,MACD底部);{----------------------利用MACD趋势进行精确顶底判断------------------------}顶部:=MACD顶部+-MACD超跌线;天际:=顶部*0.809;中轴:=MACD中轴+-MACD超跌线;海面:=顶部*0.191;底部:=MACD底部;{------------------------传统KDJ指标结合MACD优化---------------------------}RSVA:=(CLOSE-LLV(LOW,21))/(HHV(HIGH,21)-LLV(LOW,21))*顶部;{采用21日月线优化}K:SMA(RSVA,3,1),COLORFFFFFF,NODRAW;D:SMA(K,3,1),COLOR00FFFF,NODRAW;原J值参数:=3*K-2*D;JD:=IF(原J值参数<底部,底部,原J值参数);{J值底部钝化处理}J:IF(JD>顶部,顶部,JD),COLORFF00FF,NODRAW;{底部钝化处理后再进行顶部钝化处理}{---------------------------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;{---------------------------------密集成本突破-----------------------------}最高获利参数:=顶部/100;VAR1C:=(COST(89)-COST(11))*最高获利参数;VAR2C:=(COST(99.9)-COST(1))*最高获利参数;单峰:=((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公众追涨热情指标}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;{----------------------密集成本突破指标筹码峰画线--------------------------}金色背景修边1:STICKLINE(C>0 AND CURRBARSCOUNT>=2,顶部,底部,3.05,0),COLOR003333;金色背景修边2:STICKLINE(C>0 AND CURRBARSCOUNT>=2,顶部,中轴,3.05,0),COLOR003333;金色背景补充: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));高密峰墨蓝色:=DRAWBAND(高密,RGB(0,0,51),底部,RGB(0,0,255));低密峰纯蓝色:=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));{-------的通达信■新宝塔线■-----原码-----------}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<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2);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)<REF(资金异动线,1) OR REF(VOL,2)<REF(资金异动线,2)))),COLOR45AAEE;成立:=三平底翻金 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; {-------------------------------传统KDJ指标线重画--------------------------}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));【通达信】KDJMACD二合一(顶底判断、大盘动向、成本突破)-指标公式效果图(文档来源:若水财经社区)。

MACD叠加KDJ 通达信指标公式源码

MACD叠加KDJ 通达信指标公式源码

受人委托,将MACD叠加KDJ合二为一.合成后的特点是MACD与KDJ较为协调,不会产生其中任一副图的严重压缩.KDJ只保留了90天的数据,这个可以根据自己需要来调节.仅是模块,任由加工.MACD是我在传统MACD的基础上加了一条快速线,使原来的DIF变成DEA,快速线则变成DIF了,柱子还是传统MACD柱.这些都不是什么好东西,只提供有需要的人参考.DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORFF00FF,NODRAW;DEA:EMA(DIF,9),COLORCCC555,NODRAW;MACD:(DIF-DEA)*2,NODRAW;DIFT:=6*DIF-5*EMA(DIF,4);DEAT:=EMA(DIFT,4);MACDT:=(DIFT-DEAT)*2;跟庄器:IF(DIFT>0 AND MACD>0,DIFT,0),COLOR0000CC,NODRAW;DIX:(DIFT+DEA)/2,COLOR00FFFF,NODRAW;K:="KDJ.K";D:="KDJ.D";J:="KDJ.J";红天:IF(MACD>=0,BARSLAST(CROSS(MACD,0))+1,0),COLOR0000FF,NODRAW;绿天:IF(MACD<0,BARSLAST(CROSS(0,MACD))+1,0),COLOR00FF00,NODRAW;红M2:IF(红天>0,SUM(MACD,BARSLAST(CROSS(MACD,0))+1),0),COLOR0000FF,NODRAW;绿M2:IF(绿天>0,SUM(MACD,BARSLAST(CROSS(0,MACD))+1),0),COLOR00FF00,NODRAW;界面高:=CONST(HHV(DIF,120))*1.1;界面低:=CONST(HHV(DIF,120))*1.1;界面中轴:=CONST(IF(CONST((界面高+界面低)/2)>0,(界面高-界面低)/2+界面高,界面低+(界面高-界面低)/2));叠加界面高:=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0,0,MAX(ABS(界面高),ABS(界面低)));叠加界面低:=IF(CONST((HHV(DIF,10)+LLV(DIF,10))/2)>0,-MAX(ABS(界面高),ABS(界面低)),0);最大界面比例:=MAX(叠加界面高,叠加界面低);最小界面比例:=MIN(叠加界面高,叠加界面低);叠加比例中轴:=(最大界面比例+最小界面比例)/2;叠加比例差值:=最大界面比例-最小界面比例;叠加指标中轴:=(100-0)/2;叠加指标差值:=(100-0);叠加平衡基值:=0;YY100:=IF(CURRBARSCOUNT<=60,((100-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);YY80:=IF(CURRBARSCOUNT<=60,((80-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);YY50:=IF(CURRBARSCOUNT<=60,((50-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);YY20:=IF(CURRBARSCOUNT<=60,((20-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);YY00:=IF(CURRBARSCOUNT<=60,((0-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);DRAWBAND(YY100,RGB(75,75,75),YY80,DRAWNULL);DRAWBAND(YY80,RGB(40,75,40),YY50,DRAWNULL);DRAWBAND(YY50,RGB(75,75,40),YY20,DRAWNULL);DRAWBAND(YY20,RGB(0,0,155),YY00,DRAWNULL);KKYY:=IF(CURRBARSCOUNT<=60,((K-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);DDYY:=IF(CURRBARSCOUNT<=60,((D-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);JJYY:=IF(CURRBARSCOUNT<=60,((J-叠加指标中轴)*叠加比例差值/叠加指标差值+叠加比例中轴)+叠加平衡基值,DRAWNULL);DRAWBAND(DIF,RGB(60,60,60),DIX,RGB(85,5,0));STICKLINE(MACD>0,MACD,0,1.2,1),COLORD088FF;STICKLINE(MACD>0 AND MACDT>=0,MACD,0,1.2,0),COLORD088FF;STICKLINE(MACD>0 AND MACD<REF(MACD,1),MACD,0,1.2,1),COLOREEEEAA; STICKLINE(MACD>0 AND MACD<REF(MACD,1) ANDMACDT<0,MACD,0,1.2,0),COLOREEEEAA;STICKLINE(MACD<0,0,MACD,1.2,1),COLOR999000;STICKLINE(MACD<0 AND MACDT<0,0,MACD,1.2,0),COLOR999000;STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,1.2,1),COLOR2255CC; STICKLINE(MACD<0 AND MACD>=REF(MACD,1) ANDMACDT>=0,0,MACD,1.2,0),COLOR770066;零下TJ:=IF(CROSS(0,DEA),1,0);DIF金叉:=IF(DIF>0 AND CROSS(DIF,DEA),1,0);总金叉TJ:=IF(零下TJ,SUM(DIF金叉,0),0);最后金叉次:=HHV(总金叉TJ,0);总金叉次:=SUM(DIF金叉,0);轴上首金:IF(总金叉次-最后金叉次=1 AND 总金叉次>REF(总金叉次,1) AND LLV(DIF,5)>0 AND LLV(DIF,5)<0.6,HHV(MACD,20),0),COLOR0000FF;零下TJ2:=IF(CROSS(0,DEA),1,0);DIF死叉:=IF(DIF>0 AND CROSS(DEA,DIF),1,0);总死叉TJ:=IF(零下TJ2,SUM(DIF死叉,0),0);最后死叉次:=HHV(总死叉TJ,0);总死叉次:=SUM(DIF死叉,0);轴上第1次死叉:=IF(总死叉次-最后死叉次=1 AND 总死叉次>REF(总死叉次,1),1,0);死叉天:=IF(MACD<0 AND DIF>0,BARSLAST(轴上第1次死叉)+1,0);轻装上阵:IF(MACD>REF(MACD,1) AND REF(MACD<REF(MACD,1),1) AND BETWEEN(死叉天,1,15) AND REF(DIF>0 AND DIF<0.6,1),HHV(DIF,30)/2,0),COLORFF00FF;IF(跟庄器>0,IF(MACD>=0,-0.05,0.05),DRAWNULL),CIRCLEDOT,COLOR0000CC,LINETHICK2; DEA,COLOR0011EE,LINETHICK2;IF(DEA<REF(DEA,1),DEA,DRAWNULL),COLOR005900,LINETHICK2;DIF,COLORFF00FF,LINETHICK2;IF(DIF<REF(DIF,1),DIF,DRAWNULL),COLORDDDDDD,LINETHICK2;DIX,COLOR00FFFF,LINETHICK1;IF(DIX<REF(DIX,1),DIX,DRAWNULL),COLORCCC555,LINETHICK1;DRAWICON(CROSS(DIX,DIF),MACD*1.06,1);DRAWICON(CROSS(DIF,DIX),MACD*1.06,2);JJYY,COLORFFF000;KKYY,COLOR00FF00;DDYY,COLOR00FFFF;DRAWTEXT(ISLASTBAR,YY80,VARCAT('K:',VAR2STR(K,2))),COLOR00FF00; DRAWTEXT(ISLASTBAR,YY50,VARCAT('D:',VAR2STR(D,2))),COLOR00FFFF; DRAWTEXT(ISLASTBAR,YY20,VARCAT('J:',VAR2STR(J,2))),COLORFFF000;。

通达信多指标共振公式源码

通达信多指标共振公式源码

通达信多指标共振公式源码{N1:=3;N2:=5;N3:=9;N4:=13;N5:=21;N6:=34;}6.5;-0.4;{点:=REFDATE(REF(LLV(L,90),3),DATE);加仓点:点=L AND ((C-L)>(O-C) OR (O-L)>(C-O))*1,COLORYELLOW ,STICK;STICKLINE(IF(加仓点,-0.2,0),+5.6,-0.4,6,0),COLORYELLOW ;DRAWTEXT(加仓点,5.7,' 加仓点'),COLORYELLOW ;}VA:=IF(CLOSE>REF(CLOSE,1),VOL,-VOL);OBV:=SUM(IF(CLOSE=REF(CLOSE,1),0,VA),0),NODRAW;MAOBV:=MA(OBV,30),NODRAW;DRAWICON(OBV>MAOBV,5.5,1);DRAWICON(OBV<MAOBV,5.5,2);DRAWTEXT(ISLASTBAR=1,5.3,' OBV'),COLORFFFFFF;DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIFF,9);DRAWICON(DIFF>DEA,0.5,1);DRAWICON(DIFF<DEA,0.5,2);DRAWTEXT(ISLASTBAR=1,0.3,' MACD'),COLORFFFFFF;A1:=DIFF>DEA;RSV1:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:=SMA(RSV1,3,1);D:=SMA(K,3,1);DRAWICON(K>D,1.5,1);DRAWICON(K<D,1.5,2);DRAWTEXT(ISLASTBAR=1,1.3,' KDJ'),COLORFFFFFF;LC:=REF(CLOSE,1);RSI1:=(SMA(MAX(CLOSE-LC,0),5,1))/(SMA(ABS(CLOSE-LC),5,1))*100;RSI2:=(SMA(MAX(CLOSE-LC,0),13,1))/(SMA(ABS(CLOSE-LC),13,1))*100;DRAWICON(RSI1>RSI2,2.5,1);DRAWICON(RSI1<RSI2,2.5,2);DRAWTEXT(ISLASTBAR=1,2.3,' RSI'),COLORFFFFFF;RSV:=-(HHV(HIGH,9)-CLOSE)/(HHV(HIGH,9)-LLV(LOW,9))*100;LWR1:=SMA(RSV,3,1);LWR2:=SMA(LWR1,3,1);DRAWICON(LWR1>LWR2,3.5,1);DRAWICON(LWR1<LWR2,3.5,2);DRAWTEXT(ISLASTBAR=1,3.3,' LWR'),COLORFFFFFF;BBI:=(MA(CLOSE,3)+MA(CLOSE,5)+MA(CLOSE,9)+MA(CLOS E,13))/4;DRAWICON(CLOSE>BBI,4.5,1);DRAWICON(CLOSE<BBI,4.5,2);DRAWTEXT(ISLASTBAR=1,4.3,' BBI'),COLORFFFFFF;风险提示:本指标公式仅作为知识分享,不构成任何投资建议,投资有风险,交易需谨慎。

通达信指标公式源码MACD、KDJ、RSI三合一

通达信指标公式源码MACD、KDJ、RSI三合一

DIFF:EMA(CLOSE,7) - EMA(CLOSE,19),COLORGREEN;DEA:EMA(DIFF,9),COLORYELLOW;MACD:2*(DIFF-DEA),COLORSTICK;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA); 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));A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1)); B3:=REF(C,A3+1)>C ANDREF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) ANDCROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF); C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1)); D3:=REF(C,C3+1)<C ANDREF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) ANDCROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));{MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;KDJ底背:IF(B2>0,-0.1,0),COLORFF00FF,POINTDOT;RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;}MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;{STICKLINE(B1>0,-0.1,0,2,0),COLORRED;STICKLINE(B2>0,-0.1,0,2,0),COLORFF00FF;STICKLINE(B3>0,-0.1,0,2,0),COLORYELLOW;}STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;STICKLINE(D2>0,0.1,0,2,0),COLORFFCC66;STICKLINE(D3>0,0.1,0,2,0),COLORWHITE;STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORRED; STICKLINE(MACD<=REF(MACD,1) ANDMACD>0,0,MACD,0,0),COLORYELLOW;STICKLINE(MACD<REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORCYAN; STICKLINE(MACD>=REF(MACD,1) ANDMACD<0,0,MACD,0,0),COLORMAGENTA;STICKLINE(C>0,0,0,50,1),COLORBLUE;NOTEXT强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED; NOTEXT弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA; VARA1:=(DVOL/C)/2,NODRAW;VARA2:=SUM(IF(VARA1>100 AND CLOSE>REF(CLOSE,1),VARA1,0),0); VARA3:=SUM(IF(VARA1>100 AND CLOSE<REF(CLOSE,1),VARA1,0),0); VARA4:=SUM(IF(VARA1<100 AND CLOSE>REF(CLOSE,1),VARA1,0),0); VARA5:=SUM(IF(VARA1<100 AND CLOSE<REF(CLOSE,1),VARA1,0),0); VARA6:=VARA2+VARA3+VARA4+VARA5;机买:=(VARA2/VARA6)*100,LINETHICK2,COLORRED;机卖:=(VARA3/VARA6)*100,LINETHICK2,COLORGREEN;主力差:=机买-机卖,LINETHICK2,NODRAW;强度:主力差-REF(主力差,1),NODRAW,COLORYELLOW;STICKLINE(强度>1.5,-0.1,0,2,0),COLORYELLOW;近期:BARSLAST(强度>1.5),NODRAW,COLORGRAY;N:=7{2,100};M:=5{2,100};VAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;B:=SMA(VAR1,N,1);VAR2:=SMA(B,M,1);短买:CROSS(B,VAR2) AND B<40,NODRAW,COLORRED;DRAWICON(短买,0,1);。

【股票指标公式下载】-【通达信】集体共振(金叉、二次金叉)

【股票指标公式下载】-【通达信】集体共振(金叉、二次金叉)

【通达信】集体共振(金叉、二次金叉)-指标公式源码N1:=6;N2:=12;N3:=24;RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:SMA(RSV,3,1),LINETHICK2,COLORWHITE;D:SMA(K,3,1),LINETHICK2,COLORYELLOW;J:3*K-2*D,LINETHICK2,COLORRED;DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK2,COLORGREEN;DEA :EMA(DIFF,9),LINETHICK2,COLORBLUE;MACD:2*(DIFF-DEA),LINETHICK2,COLORRED;RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;KK:=SMA(RSV1,3,1);DD:=SMA(KK,3,1);JJ:=3*KK-2*DD;买卖:=IF(JJ>=100,100,IF(JJ<=0,0,JJ));明天买:IF(买卖=100,0-10,0),COLOR00CCCC;明天卖:IF(买卖=0,90,100),COLOR00FF00;TYP:=(HIGH+LOW+CLOSE)/3;STICKLINE(DIFF>REF(DIFF,1),20,20,2,0),COLORRED;STICKLINE(DIFF<REF(DIFF,1),20,20,2,0),COLORGREEN;STICKLINE(K>=REF(K,1) OR K>D AND DIFF>REF(DIFF,1),80,80,2,1),COLORRED; STICKLINE(K<REF(K,1),80,80,2,1),COLORGREEN;MACD金叉:=CROSS(MACD,DIFF) AND MACD>=(0-0.05) AND MACD<=0.02; DRAWTEXT(MACD金叉,40,'▲MACD金叉'),COLORRED;XX:=EMA(MA(LOW,3)*0.96,30);DIFF金叉:=IF(CROSS(DIFF,DEA) AND XX-REF(XX,1)>0 AND MACD>=REF(MACD,1) AND DIFF<=0,1,0);DRAWTEXT(DIFF金叉=1,35,'▲DIFF金叉'),COLORRED;低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;DRAWTEXT(低位金叉,25,'▲低位金叉'),COLORRED;DIFDEA:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(DIFDEA=2,21)=1;DRAWTEXT(二次金叉,20,'▲二次金叉'),COLORRED;A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));MACD底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);DRAWTEXT(MACD底背离,30,'▲MACD底背离'),COLORRED;A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));MACD顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);DRAWTEXT(FILTER(MACD顶背离,5),100,'▼MACD顶背离') ;周DIFF:='MACD.DIFF#WEEK';周DEA:='MACD.DEA#WEEK';周MACD:='MACD.MACD#WEEK';DIF周金叉:=CROSS(周DIFF,周DEA);DRAWTEXT(DIF周金叉,45,'▲DIFF周金叉'),COLORRED;DRAWTEXT(CROSS(周DEA,周DIFF),110,'▼DIFF周死叉') ;MACD周金叉:=CROSS(周MACD,周DIFF) AND 周MACD>=(0-0.05) AND 周MACD<=0.02;DRAWTEXT(MACD周金叉,50,'▲MACD周金叉'),COLORRED;月DIFF:='MACD.DIFF#MONTH';月DEA:='MACD.DEA#MONTH';月MACD:='MACD.MACD#MONTH';DIF月金叉:=CROSS(月DIFF,月DEA);DRAWTEXT(DIF月金叉,55,'▲DIFF月金叉'),COLORRED ; DRAWTEXT(CROSS(月DEA,月DIFF),105,'▼DIFF月死叉') ;MACD月金叉:=CROSS(月MACD,月DIFF) AND 月MACD>=(0-0.05) AND 月MACD<=0.02;DRAWTEXT(MACD月金叉,60,'▲MACD月金叉'),COLORRED;周K:="KDJ.K#WEEK"(9,3,3);周D:="KDJ.D#WEEK"(9,3,3);周J:="KDJ.J#WEEK"(9,3,3);月K:="KDJ.K#MONTH"(9,3,3);月D:="KDJ.D#MONTH"(9,3,3);月J:="KDJ.J#MONTH"(9,3,3);KD月金叉:=CROSS(月K,月D);KD周金叉:=CROSS(周K,周D);KD日金叉:=FILTER(CROSS(K,D) AND D<50,4);KD低位金叉:=FILTER(CROSS(K,D) AND D<20,4);DRAWTEXT(KD月金叉,0,'▲KD月金叉'),COLORRED;DRAWTEXT(KD周金叉,-5,'▲KD周金叉'),COLORRED ;DRAWTEXT(KD日金叉,-10,'▲KD日金叉'),COLORRED ;DRAWTEXT(KD低位金叉,5,'▲KD低位金叉'),COLORRED;KD1:=COUNT(CROSS(K,D),BARSLAST(D>=50));KD二次金叉:=CROSS(K,D) AND D<50 AND COUNT(KD1=2,21)=1;DRAWTEXT(KD二次金叉,10,'▲KD二次金叉'),COLORRED ;KD2:=COUNT(CROSS(D,K),BARSLAST(D<=50));KD二次死叉:=CROSS(D,K) AND D>50 AND COUNT(KD2=2,21)=1;DRAWTEXT(KD二次死叉,95,'▼KD二次死叉') ;KD日死叉:=FILTER(CROSS(D,K) AND D>80,4);DRAWTEXT(KD日死叉,80,'▼KD日死叉') ;DRAWTEXT(CROSS(周D,周K),85,'KD周死叉') ;DRAWTEXT(CROSS(月D,月K),90,'KD月死叉') ;KDB:=BARSLAST(REF(CROSS(K,D),1));KDDB:=REF(CLOSE,KDB+1)>CLOSE AND REF(K,KDB+1)<K AND CROSS(K,D);KDJ底背离:=IF(FILTER(KDDB>0,5),1,0);DRAWTEXT(KDJ底背离=1,15,'▲KDJ底背离'),COLORRED;KDD:=BARSLAST(REF(CROSS(D,K),1));KDJ顶背离:=REF(CLOSE,KDD+1)<CLOSE AND REF(K,KDD+1)>K AND CROSS(D,K); DRAWTEXT(FILTER(KDJ顶背离>0,5),120,'▼KDJ顶背离') ;RSI周金:DRAWTEXT(CROSS("RSI.RSI1#WEEK"(N1,N2,N3),"RSI.RSI2#WEEK"(N1,N2,N3) ) ,65,'▲RSI周金'),COLORRED;RSI周死:DRAWTEXT(CROSS("RSI.RSI2#WEEK"(N1,N2,N3),"RSI.RSI1#WEEK"(N1,N2,N3) ) ,130,'▼RSI周死') ;RSI月金:DRAWTEXT(CROSS("RSI.RSI1#MONTH"(N1,N2,N3),"RSI.RSI2#MONTH"(N1,N2,N 3)) ,70,'▲RSI月金'),COLORRED;RSI月死:DRAWTEXT(CROSS("RSI.RSI2#MONTH"(N1,N2,N3),"RSI.RSI1#MONTH"(N1,N2,N 3)) ,115,'▼RSI月死') ;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底背离:=FILTER(B3>0,5);DRAWTEXT(RSI底背离,75,'▲RSI底背离'),COLORRED;C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));RSI顶背离:=FILTER(D3>0,5);DRAWTEXT(RSI顶背离,125,'▼RSI顶背离') ;{预涨}AZ:=DYNAINFO(7);AC1:=REF(C,1);ZF1:=(AZ-AC1)/AC1*100;BZ:=DYNAINFO(8);BV1:=REF(VOL,1);ZF2:=BZ/BV1*100;DZ:=REF(CLOSE,1)-REF(OPEN,1);EZ:=DYNAINFO(23)-DYNAINFO(22);FZ:=REF(VOL,1)-REF(VOL,2);预涨:=ZF1>1 AND ZF1<5 AND ZF2>30 AND DZ>0 AND EZ>0 AND FZ>0 AND D>REF(D,1); DRAWTEXT(预涨,D*0.6,'预\N涨'),COLOR00CC00;KX:=250;KH:=HHV(K,KX);DH:=HHV(D,KX);JH:=HHV(J,KX);KL:=LLV(K,KX);DL:=LLV(D,KX);JL:=LLV(J,KX);HKMAX:=MAX(KH,MAX(DH,JH));LKMIN:=MIN(KL,MIN(DL,JL));KHLB:=(HKMAX+LKMIN)/2;KHLC:=HKMAX-LKMIN;MHF:=HHV(DIFF,KX);MHD:=HHV(DEA,KX);MHM:=HHV(MACD,KX);MLF:=LLV(DIFF,KX);MLD:=LLV(DEA,KX);MLM:=LLV(MACD,KX);HMAX:=MAX(MHF,MAX(MHD,MHM));LMIN:=MIN(MLF,MIN(MLD,MLM));FHLB:=(HMAX-LMIN)/100;FHLC:=HMAX-LMIN;SH:=(0-FHLB)*(KHLC/FHLC)+KHLB;DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;MD1:=MA(CLOSE,80)-MA(CLOSE,13)/3;MD2:=MA((CLOSE-MD1)/MD1,3);买点1:=CROSS(MD2,0) AND LOW/REF(HIGH,1)<1.012 AND J<75 AND J>REF(J,1); MA12:=MA(CLOSE,12);佳点:=IF(FILTER(MACD>=REF(MACD,5) AND OPEN<=REF(CLOSE,1) ANDXX-REF(XX,1)>0 AND MACD<=0 AND MA12-REF(MA12,1)>=0,3) AND J<80 ANDJ>REF(J,1) AND D>REF(D,1) AND (DIFF>=REF(DIFF,1) ORDEA>=REF(DEA,1)),1,0);DRAWTEXT(佳点=1,MACDA*0.98,'佳点'),COLOR00CC00;DX0:=EMA(CLOSE,2)-EMA(OPEN,5);DX1:=IF(CROSS(DX0,MACD) AND LOW<=XX AND MACD<=(0-0.11) AND (J<20 ORK<20),1,0);DRAWTEXT(FILTER(DX1,3),0,'短10%'),COLOR00CC00;{短线}MA10:=MA(CLOSE,10); SS:=EMA(MA(HIGH,3)*1.05,30);LQS:=IF(FILTER(0.7*(CROSS(DIFF,DEA) AND CLOSE<SS AND XX-REF(XX,1)>0 AND CROSS(MACD,0) AND MACD>=0 AND DIFF>0 AND MA10-REF(MA10,1)>0 ANDVOL>REF(VOL,1))>=0.7 AND (CLOSE<SS AND XX-REF(XX,1)>0),5) AND J<80,1,0); DRAWTEXT(LQS=1,MACDA*0.98,'量价齐上'),COLOR00CC00;{量价齐上}最佳点:=IF(COUNT(MD2>REF(MD2,1),3)=3 AND COUNT(MD2<0,10)=10 ANDREF(MD2,3)=LLV(MD2,10) AND J<80 AND J>REF(J,1),1,0);DRAWTEXT(最佳点=1,J,'最佳点'),COLOR00CC00;买点2:=REF(MD2,2)=LLV(MD2,20) AND REF(MD2,2)<0.071 ANDREF(MD2,2)<REF(MD2,1) ANDNOT(REF(LOW,1)>REF(HIGH,2) AND LOW>REF(HIGH,1)) AND CLOSE>REF(CLOSE,1) AND J<75 AND J>REF(J,1);DRAWTEXT(买点1 OR 买点2,D-1,'买'),COLOR00CC00;【通达信】集体共振(金叉、二次金叉)-指标公式效果图(文档来源:若水财经社区)。

【指标公式源码下载】通达信MACD+KDJ指标公式

【指标公式源码下载】通达信MACD+KDJ指标公式

通达信MACD+KDJ指标公式RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K0:=SMA(RSV,3,1);D0:=SMA(K0,3,1);J0:=3*K0-2*D0;DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORGREEN,NODRAW; DEA:EMA(DIFF,9),COLORLIRED,NODRAW;MACD:2*(DIFF-DEA),COLORMAGENTA,NODRAW;{RSV1:=(HHV(H,9.8)-C)/(HHV(H,9.8)-LLV(L,9.8))*101;KK:=SMA(RSV1,3,1);DD:=SMA(KK,3,1);JJ:=3*KK-2*DD; }KX:=250;KH:=HHV(K0,KX);DH:=HHV(D0,KX);JH:=HHV(J0,KX);KL:=LLV(K0,KX);DL:=LLV(D0,KX);JL:=LLV(J0,KX);HKMAX:=MAX(KH,MAX(DH,JH));LKMIN:=MIN(KL,MIN(DL,JL));KHLB:=(HKMAX+LKMIN)/2;KHLC:=HKMAX-LKMIN;MHF:=HHV(DIFF,KX);MHD:=HHV(DEA,KX);MHM:=HHV(MACD,KX);MLF:=LLV(DIFF,KX);MLD:=LLV(DEA,KX);MLM:=LLV(MACD,KX);HMAX:=MAX(MHF,MAX(MHD,MHM));LMIN:=MIN(MLF,MIN(MLD,MLM));FHLB:=(HMAX-LMIN)/100;FHLC:=HMAX-LMIN;SH:(0-FHLB)*(KHLC/FHLC)+KHLB,COLOR00AAAA;{DIFFA:=(DIFF-FHLB)*(KHLC/FHLC)+KHLB;DEAA:=(DEA-FHLB)*(KHLC/FHLC)+KHLB;DRAWBAND(DIFFA,RGB(255,110,150),DEAA,RGB(100,255,150));} DRAWTEXT(ISLASTBAR=1,SH,' 0 轴'),COLOR00AAAA;K:K0,LINETHICK2,COLORFF6600;D:D0,LINETHICK2,COLOR99FF00;J:J0,LINETHICK2,COLORRED;MACDA:=(MACD-FHLB)*(KHLC/FHLC)+KHLB;CDA:=MACD<REF(MACD,1) AND MACD>0;CDB:=MACD>=REF(MACD,1) AND MACD>0;CDC:=MACD>REF(MACD,1) AND MACD<0;CDD:=MACD<=REF(MACD,1) AND MACD<0;STICKLINE(CDA,SH,MACDA,1.8,0),COLOR0066FF;{黄色段} STICKLINE(CDA,SH,MACDA,1.5,0),COLOR0077FF;STICKLINE(CDA,SH,MACDA,1.2,0),COLOR0088FF;STICKLINE(CDA,SH,MACDA,1.0,0),COLOR0099FF;STICKLINE(CDA,SH,MACDA,0.8,0),COLOR00AAFF;STICKLINE(CDA,SH,MACDA,0.5,0),COLOR00EEFF;STICKLINE(CDB,SH,MACDA,1.8,0),COLOR0000AA; {红色段} STICKLINE(CDB,SH,MACDA,1.5,0),COLOR0011BB;STICKLINE(CDB,SH,MACDA,1.2,0),COLOR0022CC;STICKLINE(CDB,SH,MACDA,1.0,0),COLOR0033DD;STICKLINE(CDB,SH,MACDA,0.8,0),COLOR0044EE;STICKLINE(CDB,SH,MACDA,0.5,0),COLOR0055FF;STICKLINE(CDC,SH,MACDA,1.8,0),COLORAA00BB;{向上粉红} STICKLINE(CDC,SH,MACDA,1.5,0),COLORBB11BB;STICKLINE(CDC,SH,MACDA,1.2,0),COLORCC22BB;STICKLINE(CDC,SH,MACDA,1.0,0),COLORDD33BB;STICKLINE(CDC,SH,MACDA,0.8,0),COLOREE44BB;STICKLINE(CDC,SH,MACDA,0.5,0),COLORFF55BB;STICKLINE(CDD,SH,MACDA,1.8,0),COLOR007700;{青色} STICKLINE(CDD,SH,MACDA,1.5,0),COLOR008811;STICKLINE(CDD,SH,MACDA,1.2,0),COLOR00AA22;STICKLINE(CDD,SH,MACDA,1.0,0),COLOR00BB33;STICKLINE(CDD,SH,MACDA,0.8,0),COLOR00DD44;STICKLINE(CDD,SH,MACDA,0.5,0),COLOR00DD55;{顶底信号}VAR51:=(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34))*100;VAR52:=SMA(VAR51,4,1);VAR53:=SMA(VAR52,6,1);VAR54:=VOL/CAPITAL*34;VAR55:=REF(VAR54,1);STICKLINE(VAR53<7 AND VAR52<11,-3,0,3,0),LINETHICK2,COLORYELLOW; STICKLINE(VAR53>89.5 AND VAR52>91,100,97,3,0),LINETHICK1,COLORFF8888; STICKLINE(VAR53>88.5 AND VAR52>94.6,100,95,5,0),COLORRED;。

MACD叠加KDJ通达信指标公式源码

MACD叠加KDJ通达信指标公式源码

MACD叠加KDJ通达信指标公式源码MACD (Moving Average Convergence Divergence) and KDJ are two popular technical indicators used in stock market analysis. MACD is a trend-following momentum indicator that shows the relationship between two moving averages of a security's price, while KDJ is a momentum oscillator that identifies overbought and oversold conditions.The formula for MACD is as follows:MACD Line = 12-day EMA - 26-day EMASignal Line = 9-day EMA of MACD LineHistogram = MACD Line - Signal LineThe formula for KDJ is as follows:RSV = (Close Price - Lowest Low) / (Highest High - Lowest Low) * 100K=SMA(RSV,N1,1)D=SMA(K,N2,1)J=3*K-2*D```pythonfrom indicator.base_indicator import BaseIndicatorfrom indicator.indicator_result import IndicatorResultclass MacdKdjIndicator(BaseIndicator):def __init__(self, n1=12, n2=26, n3=9, n4=9, n5=3):super(.__init__self.n1 = n1self.n2 = n2self.n3 = n3self.n4 = n4self.n5 = n5def calculate_indicator(self, data):close_prices = data['close']high_prices = data['high']low_prices = data['low']ema12 = close_prices.ewm(span=self.n1, adjust=False).mean ema26 = close_prices.ewm(span=self.n2, adjust=False).mean macd_line = ema12 - ema26signal_line = macd_line.ewm(span=self.n3, adjust=False).mean histogram = macd_line - signal_linelowest_low = low_prices.rolling(window=self.n4).minhighest_high = high_prices.rolling(window=self.n4).maxrsv = (close_prices - lowest_low) / (highest_high -lowest_low) * 100k = rsv.rolling(window=self.n1).meand = k.rolling(window=self.n2).meanj=3*k-2*dindicator_result = IndicatorResultindicator_result.data['macd_line'] = macd_lineindicator_result.data['signal_line'] = signal_lineindicator_result.data['histogram'] = histogramindicator_result.data['k'] = kindicator_result.data['d'] = dindicator_result.data['j'] = jreturn indicator_result```In the code above, we have defined a class`MacdKdjIndicator` that inherits from the `BaseIndicator` class. The `calculate_indicator` method calculates MACD and KDJ indicators using the given parameters `n1`, `n2`, `n3`, `n4`, and `n5`.We have used the `pandas` library to calculate the moving averages and rolling means for the MACD and KDJ indicators. The resulting data is stored in an `IndicatorResult` object that can be used for further analysis and visualization.。

KDJ+MACD金叉共振副图公式,不加密,通达信,副图公式,股票指标公式分享平台

KDJ+MACD金叉共振副图公式,不加密,通达信,副图公式,股票指标公式分享平台

KDJ+MACD金叉共振副图公式,不加密,通达信,副图公式,股票指标公式分享平台图片:指标:DIF:(EMA(CLOSE,6)-EMA(CLOSE,13))*100;DEA:EMA(DIF,5);MACD:(DIF-DEA)*2,COLORSTICK;DRAWICON(CROSS(DIF,DEA),DEA,1);DRAWICON(CROSS(DEA,DIF),DEA,2);IF(DIF<DEA,DIF,DRAWNULL),COLORGREEN;DD:=C=HHV(C,180);EE:=DEA< REF(DEA,1) AND REF(DEA< REF(DEA,1),1)=1;CC:=C> REF(C,1) AND REF(C> REF(C,1),1)=1;顶背离:=(DD AND EE AND DEA< HHV(DEA,180))*DEA;A2:=BARSLAST(REF(CROSS(DEA,DIF),1));{顶背:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF A ND CROSS(DEA,DIF);}DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORBROWN,LINETH ICK2;RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;K:SMA(RSV,9,3),COLORMAGENTA;D:SMA(K,9,3),COLORBLUE;J:3*K-2*D,COLORGRAY;IF(J<D,J,DRAWNULL),COLORFFEE44;A1:=BARSLAST(REF(CROSS(DIF,DEA),1));B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(D IF,DEA);A22:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)), 1));B2:=REF(C,A22+1)>C AND REF("KDJ.K"(9,3,3),A22+1)<"KDJ. K"(9,3,3) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));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)<"R SI.RSI1"(6,12,24) AND CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12, 24));DRAWTEXT(B1,DEA-0.20,'▲M ACD底背'),COLORWHITE;DRAWTEXT(B2,D-0.20,'●KDJ底背'),COLORYELLOW;{DJ:=CROSS(J,D) AND D<20;DRAWTEXT(DJ,J-0.3,'低金叉'),COLORMAGENTA;MDJ:=CROSS(DIF,DEA) AND DEA<0;DRAWTEXT(MDJ,DEA-0.3,'低金叉'),COLORRED;DRAWTEXT(CROSS(DEA,DIF),DIF+0.3,'死叉'),COLORCYAN;DRAWTEXT(CROSS(D,J),J+0.3,'死叉'),COLORGREEN;}A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);DRAWICON(A,LOW*0.98,1);B4:CROSS(DIF,DEA) AND CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3, 3));DRAWTEXT(B4,L-0.20,'★金叉共振'),COLOR0099FF;DRAWICON(CROSS(K,D),D,1);DRAWICON(CROSS(D,K),D,2);BA:=DEA>REF(DEA,1);BB:=SUM(BA,5)>=4;BC:=C<O;BD:=SUM(BC,5)>=2;BXG:FILTER(BB AND BD AND J>REF(J,1) AND REF(J,1)<REF(J, 2),3);STICKLINE(BXG,HHV(J,60),HHV(J,60)-20,1,0),COLORRED;SS:=EMA(C,11);LL:=(EMA(C,1)+EMA(C,2)+EMA(C,3)+EMA(C,5))/4;AA:=(C-LLV(C,10))/(HHV(C,10)-LLV(C,10));(CROSS(AA,0.05)-1);。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
相关文档
最新文档