在线检测未来函数

通达信MACD叠加KDJ指标公式

来源:Internet,编辑:股旁网,2015-12-15

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) AND MACDT<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) AND MACDT>=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;

通达信MACD叠加KDJ指标公式

 

相关文章