{// 导入公式:[新MCAD] 修改日期:MON OCT 24 12:39:16 2016}{123 叉数字以上源码都可以用在飞狐。kt交易师 大智慧上}
DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK ;
STICKLINE(MACD 0,0,MACD,3,1),COLORMAGENTA;
STICKLINE(MACD 0,0,MACD,3,1),COLORFFFFFF ;
{STICKLINE(MACD 0,0.000001,MACD,8,0),COLORMAGENTA;}
{STICKLINE(MACD 0,-0.000001,MACD,8,0),COLORFFFFFF ; }
X_2:=BARSLAST(REF(MACD,1) 0 AND MACD
X_3:=LLVBARS(MACD,X_2+20);
X_4:=IF(X_3 X_2,REF(MACD,X_3),0);
X_5:=MACD 0 AND MACD X_4 AND LOW=LLV(LOW,X_2+20) AND X_4
X_6:=REF(X_5,1)=1 AND MACD REF(MACD,1) AND REF(DIF,X_3) 0 AND MACD
低背:DRAWLINE(X_4=X_3,MACD,X_6,MACD,0),COLORRED,LINETHICK2;
DRAWICON(X_6,MACD*1.2,7);
X_7:=HHVBARS(MACD,X_2+20);
X_8:=IF(X_7 X_2,REF(MACD,X_7),0);
X_9:=MACD 0 AND MACD X_8 AND HIGH=HHV(HIGH,X_2+20) AND X_8
X_10:=REF(X_9,1)=1 AND MACD REF(MACD,1) AND REF(DIF,X_7)
顶背:DRAWLINE(X_8=X_7,MACD,X_10,MACD,0),COLORGREEN,LINETHICK2;
DRAWICON(X_10,MACD*1.2,8);
{99}
VA1:=HHVBARS(MACD,BARSLAST(MACD 0)+1);
VA2:=CROSS(BACKSET(CROSS(0,MACD){ OR (ISLASTBAR AND MACD 0)},REF(VA1,1)+2),0.5);{前高}
VA2JL:=BARSLAST(VA2);
VA2J:=IF(VA2JL=0,MACD,REF(MACD,VA2JL));{前高}
{STICKLINE(VA2J 0,VA2J,VA2J,2,1),COLORMAGENTA;}{全都画线}
前高Q:DRAWLINE(VA2,MACD,ISLASTBAR,REF(MACD,BARSLAST(VA2)),0),COLORMAGENTA, LINETHICK1;
STICKLINE(MACD VA2J,MACD,VA2J,3,0),COLORYELLOW;
高点:=IF(VA2JL=0,HIGH,REF(HIGH,VA2JL));
A前高:={C 高点 AND} CROSS(MACD,VA2J )AND MACD VA2J ;
STICKLINE(A前高,-0.0001,MACD,3,0),COLORWHITE;
{88}
VA3:=LLVBARS(MACD,BARSLAST(MACD 0)+1);
VA4:=CROSS(BACKSET(CROSS(MACD,0) {OR (BARSTATUS=2 AND MCD 0)},REF(VA3,1)+2),0.5);
VA4JL:=BARSLAST(VA4);
前低:=IF(BARSLAST(VA4)=0,MACD,REF(MACD,VA4JL));{MACD的前低}
低点:=IF(VA4JL=0,L,REF(L,VA4JL));{股价的前低}
{//VA4J:=前低;
//STICKLINE(1,VA4J,VA4J,3,1),COLORYELLOW;{全都画线}
前低Q:DRAWLINE(VA4,MACD,ISLASTBAR,REF(MACD,BARSLAST(VA4)),0),COLOR0000FF ,LINETHICK1;{ 现价 前低MACD画线 }
A前低:=CROSS(前低, MACD )AND MACD
P前低:=C 低点 AND CROSS(前低, MACD ) ;
STICKLINE(MACD 前低 ,MACD,前低,3,0),COLORBLUE;
STICKLINE(A前低,-0.0001,MACD,3,0),COLORMAGENTA;
DRAWICON(P前低,MACD*1.2,12);
{123 金叉数字}
DONCROSS:=IF(CROSS(DIF,DEA) AND DEA 0,1,0);{0上金叉}
DUNDERCROSS:=IF(CROSS(DIF,DEA) AND DIF 0,1,0);{0下金叉}
KONCROSS:=IF(CROSS(DEA,DIF) AND DIF 0,1,0);{0上死叉}
KUNDERCROSS:=IF(CROSS(DEA,DIF) AND DEA 0,1,0);{0下死叉}
A7:=VAR2STR(COUNT(DUNDERCROSS,BARSLAST(DIF 0)+1),0),NODRAW;
DRAWTEXT(DONCROSS,DEA,VAR2STR(COUNT(DONCROSS,BARSLAST(DIF 0)+1),0)),COLORRED;
DRAWTEXT(DUNDERCROSS,DEA,A7),COLORYELLOW;
DRAWTEXT(KONCROSS,DIF,VAR2STR(COUNT(KONCROSS,BARSLAST(DIF 0)+1),0)),COLORCYAN;
DRAWTEXT(KUNDERCROSS,DIF,VAR2STR(COUNT(KUNDERCROSS,BARSLAST(DIF 0)+1),0)),COLORGREEN;
M周▲:DRAWTEXT(CROSS( MACD.DIF#WEEK , MACD.DEA#WEEK ),0,'▲M周'),COLORRED;
M月个:DRAWTEXT(CROSS( MACD.DIF#MONTH , MACD.DEA#MONTH ),0,'▲M月'),COLORMAGENTA;
{PPP}
X_3A:=DIF;
X_4A:=DEA;
X_5A:=MACD;
X_8A:=HHVBARS(X_3A,BARSLAST(X_5A 0)+1);
X_9A:=CROSS(BACKSET(CROSS(0,X_5A),REF(X_8A,1)+2),0.5);
X_10A:=X_9A;
X_11A:=BACKSET(ISLASTBAR,BARSLAST(X_10A)+1);
X_12A:=X_11A REF(X_11A,1);
X_13A:=REF(X_3A,BARSLAST(X_12A));
DRAWICON(CROSS(X_3A,X_13A),X_3A,41);
X_14A:=CONST(IF(CURRBARSCOUNT =81,HHV(MAX(X_5A,MAX(X_3A,X_4A)),BARSLAST(CURRBARSCOUNT=81)),0));
X_15A:=CONST(IF(CURRBARSCOUNT =81,LLV(MIN(X_5A,MIN(X_3A,X_4A)),BARSLAST(CURRBARSCOUNT=81)),0));
X_16A:=FILTERX(CROSS(X_3A,X_4A),BARSSINCE(CLOSE));
X_17A:=SUM(CROSS(X_3A,X_4A),BARSSINCE(CLOSE));
X_18A:=CROSS(REFX(X_17A,BARSNEXT(X_16A))=X_17A+1,0.5);
STICKLINE(BARSLAST(X_18A) =0 AND CROSS(X_3A,X_4A),X_14A,X_15A,0,(-1)),COLORGREEN;
STICKLINE(BARSLAST(X_18A) =0 AND CROSS(X_3A,X_4A) AND X_3A =0,X_14A,X_15A,0,(-1)),COLORRED;
X_23:=LLVBARS(X_5A,BARSLAST(X_5A 0)+1);
X_24:=CROSS(BACKSET(CROSS(X_5A,0),REF(X_23,1)+2),0.5);
X_25:=BARSLAST(FILTERX(CROSS(0,X_5A),BARSCOUNT(CLOSE)));
X_26:=DRAWLINE(X_24,X_5A,REF(X_24,1),REF(X_5A,1),1);
X_76:=BARSLAST(REF(CROSS(X_3A,X_4A),1));
X_77:=CROSS(X_3A,X_4A) AND X_3A REF(X_3A,X_76+1) AND X_76 100 AND X_3A 0 AND LOW REF(LOW,X_76+1);
X_78:=BARSLASTCOUNT(X_3A X_4A);
DRAWNUMBER(ISLASTBAR,X_26,X_78),COLORGREEN,LINETHICK9;
DRAWICON(CROSS(X_3A,X_13A),X_3A,41);