通达信看盘MACD指标(源码)

2015-09-11 21:51:00来源:本站整理浏览:585

DIF:(EMA(CLOSE,12)-EMA(CLOSE,26)),COLORFF00FF;
DEA:EMA(DIF,9),COLORCCC555;
MACD:(DIF-DEA)*2,COLORSTICK;
MACD2:=MA(MACD,4);
判断顶背:=IF(CROSS(DEA,DIF),HHV(DIF,10),REF(HHV(DIF,10),BARSLAST(CROSS(DEA,DIF))));
判断底背:=IF(CROSS(DIF,DEA),LLV(DIF,10),REF(LLV(DIF,10),BARSLAST(CROSS(DIF,DEA))));
{MACD红绿天和面积}
红天:IF(MACD>=0,BARSLAST(CROSS(MACD,0))+1,0),COLOR0000FF,NODRAW;
绿天:IF(MACD<0,BARSLAST(CROSS(0,MACD))+1,0),COLOR00FF00,NODRAW;
红柱面积:IF(红天>0,SUM(MACD,BARSLAST(CROSS(MACD,0))+1),0),COLOR0000FF,NODRAW;
绿柱面积:IF(绿天>0,SUM(MACD,BARSLAST(CROSS(0,MACD))+1),0),COLOR00FF00,NODRAW;
DF低位金叉:=CROSS(DIF,DEA) AND DIF<0;
DF金叉周期:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
DF上次金叉:=BARSLAST(REF(CROSS(DIF,DEA),1));
MD底背离:=REF(LLV(L,5),DF上次金叉+1)>LLV(L,5) AND LLV(MACD,5)>REF(LLV(MACD,5),DF上次金叉+1) AND CROSS(DIF,DEA);
DF二次金叉1:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(DF金叉周期=2,21)=1;
DF二次金叉:=DF二次金叉1 AND MD底背离;
DF底背离:=REF(LLV(L,5),DF上次金叉+1)>LLV(L,5) AND DIF>REF(DIF,DF上次金叉+1) AND CROSS(DIF,DEA);
DF上次死叉:=BARSLAST(REF(CROSS(DEA,DIF),1));
DF顶背离:=REF(HHV(C,5),DF上次死叉+1)<H AND REF(DIF,DF上次死叉+1)>DIF AND CROSS(DEA,DIF);
绿柱短了:=(MACD>REF(MACD,1) AND DIF<DEA) AND COUNT(MACD>REF(MACD,1) AND DIF<DEA,10)=1 AND C>MA(C,55) AND COUNT(MACD<0,5)>=5;
DIFZ:=MACD.DIF#WEEK;
DEAZ:=MACD.DEA#WEEK;
DIFR:=MACD.DIF#DAY;
DEAR:=MACD.DEA#DAY;
WEKZ:=REFX(WEEKDAY<REF(WEEKDAY,1) OR DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7,1) OR ISLASTBAR;
WEKR:=REFX(DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7 OR DAYTODATE(HOUR)-DAYTODATE(REF(HOUR,1))>=4,3) OR ISLASTBAR;
WEKM:=REFX(DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7 OR DAYTODATE(HOUR)-DAYTODATE(REF(HOUR,1))>=8,7) OR ISLASTBAR;
WEKF:=REFX(DATETODAY(DATE)-DATETODAY(REF(DATE,1))>=7 OR DAYTODATE(HOUR)-DAYTODATE(REF(HOUR,1))>=16,15) OR ISLASTBAR;
DIFDD:=IF(PERIOD=5 AND WEKZ,DIFZ,IF(PERIOD=4 AND WEKR,DIFR,IF(PERIOD=3 AND WEKM,DIFR,IF(PERIOD=2 AND WEKF,DIFR,DRAWNULL))));
DEADD:=IF(PERIOD=5 AND WEKZ,DEAZ,IF(PERIOD=4 AND WEKR,DEAR,IF(PERIOD=3 AND WEKM,DEAR,IF(PERIOD=2 AND WEKF,DEAR,DRAWNULL))));
WDIF:ALIGNRIGHT(DIFDD),NODRAW,COLOR00FF99;
WDEA:ALIGNRIGHT(DEADD),NODRAW,COLOR00FF99;
WMACD:(WDIF-WDEA)*2,NODRAW,COLOR00FF99;
ZMACD:=WMACD;
CSTA1:=CONST(LLV(MACD,120))*1.35;
CSTQ:=IF(PERIOD=5,0.5,IF(PERIOD=4,0.35,IF(PERIOD=3,0.2,IF(PERIOD=2,0.15,DRAWNULL))));
{乖离}
HL乖离5:=(C/((HHV(C,5)+LLV(C,5))/2)-1)*100;
HL乖离10:=(C/((HHV(C,10)+LLV(C,10))/2)-1)*100;
{KDJ}
K:=KDJ.K;
D:=KDJ.D;
J:=KDJ.J;
KZ:=KDJ.K#WEEK;
DZ:=KDJ.D#WEEK;
JZ:=KDJ.J#WEEK;
KR:=KDJ.K#DAY;
DR:=KDJ.D#DAY;
JR:=KDJ.J#DAY;
KDZJC:=BARSLAST(WEEKOFYEAR<>REF(WEEKOFYEAR,1))+1;
ZJC2:=REF(KZ,KDZJC)<REF(DZ,KDZJC) AND KZ>DZ;
ZXC2:=REF(KZ,KDZJC)>REF(DZ,KDZJC) AND KZ<DZ;
KDRJC:=BARSLAST(DAY<>REF(DAY,1))+1;
RJC2:=REF(KR,KDRJC)<REF(DR,KDRJC) AND KR>DR;
RXC2:=REF(KR,KDRJC)>REF(DR,KDRJC) AND KR<DR;
KKZR:=IF(PERIOD=5,KZ,IF(PERIOD=4,KR,IF(PERIOD=3,KR,IF(PERIOD=2,KR,DRAWNULL))));
DDZR:=IF(PERIOD=5,DZ,IF(PERIOD=4,DR,IF(PERIOD=3,DR,IF(PERIOD=2,DR,DRAWNULL))));
JJZR:=IF(PERIOD=5,JZ,IF(PERIOD=4,JR,IF(PERIOD=3,JR,IF(PERIOD=2,JR,DRAWNULL))));
KDJJC:=IF(PERIOD=5,ZJC2,IF(PERIOD>1 AND PERIOD<5,RJC2,DRAWNULL));
KDJXC:=IF(PERIOD=5,ZXC2,IF(PERIOD>1 AND PERIOD<5,RXC2,DRAWNULL));
CONHH:=CONST(HHV(MAX(HHV(DIF,20),HHV(MACD,20)),90));
{画色}
DRAWBAND(WDIF*CSTQ+CSTA1,RGB(105,46,56),WDEA*CSTQ+CSTA1,RGB(0,108,108));
{柱子}
STICKLINE(HL乖离10>=20 AND REF(K>85,1) AND K<REF(K,1) AND H>REF(H,1),MACD,0,4,0),COLOR00FF00;
STICKLINE(ZMACD>0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,3,0),COLOR6060EE;
STICKLINE(ZMACD>0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,1.6,0),COLOR7070EE;
STICKLINE(ZMACD>0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,0.8,0),COLOR8080EE;
STICKLINE(ZMACD>0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,3,0),COLORA0A0A0;
STICKLINE(ZMACD>0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,1.8,0),COLORB0B0B0;
STICKLINE(ZMACD>0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,0.8,0),COLORC0C0C0;
STICKLINE(ZMACD<0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,3,0),COLOR003399;
STICKLINE(ZMACD<0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,1.6,0),COLOR114499;
STICKLINE(ZMACD<0 AND ZMACD>=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,0.8,0),COLOR225599;
STICKLINE(ZMACD<0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,3,0),COLORDDD000;
STICKLINE(ZMACD<0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,1.8,0),COLOREEE000;
STICKLINE(ZMACD<0 AND ZMACD<=REF(ZMACD,1),ZMACD*CSTQ+CSTA1,CSTA1,0.8,0),COLORFFF000;
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),MACD,0,2,0),COLOR0000DD;

[1] [2]  下一页

股票公式栏目导航

精品指标推荐

最新热门

本类随机推荐

相关公式