【通达信源码分享】精品指标公式-自制MACD指标源码

通达信免费指标 10-22 阅读:932 评论:0

公式源码:


D1:=EMA(C,4)-EMA(C,13);


D2:=EMA(O,4)-EMA(O,13);


D3:=EMA(H,4)-EMA(H,13);


D4:=EMA(L,4)-EMA(L,13);


V111:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);


趋势1:=EMA(V111,3);


V112:=(趋势1-REF(趋势1,1))/REF(趋势1,1)*100; 


{准备1: STICKLINE(趋势1<=13,-0.75,-1.5,5,0),COLORCC7700;}


AA1:=(趋势1<=13) AND FILTER((趋势1<=13),15),COLORCC9900;


主力建仓1: STICKLINE(趋势1<=13 AND V112>13,0,-0.45,5,0),COLORLICYAN;


BB1:= (趋势1<=13 AND V112>13) AND FILTER((趋势1<=13 AND V112>13),10);


DRAWTEXT (BB1,-0.25,'建仓'),COLORMAGENTA;


主力出货1: STICKLINE(趋势1>=90 AND V112,0,0.45,5,0),COLORLIMAGENTA;


CC1:=(趋势1>=90 AND V112) AND FILTER((趋势1>=90 AND V112),10);


DRAWTEXT (CC1,0.5,'出货'),COLORGREEN;


 


{DRAWKLINE(D3,D2,D4,D1);}


 


{STICKLINE(D1>=D2,D1,D2,3,0),COLOR0055AA;


STICKLINE(D1<=D2,D1,D2,2.5,0),COLOR006600;


STICKLINE(D1>=D2,D1,D2,2,0),COLOR0077CC;


STICKLINE(D1>=D2,D1,D2,1.5,0),COLOR0099DD;


STICKLINE(D1>=D2,D3,D4,0,0),COLOR00BBFF;


STICKLINE(D1<=D2,D1,D2,2.5,0),COLOR009900;


STICKLINE(D1<=D2,D1,D2,2,0),COLOR00BB00;


STICKLINE(D1<=D2,D3,D4,0,0),COLOR00EE00;}


 


 


DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);


DEA:EMA(DIF,MID);


MACD:(DIF-DEA)*2,COLORSTICK;


红柱:IF(MACD>=REF(MACD,1),MACD,DRAWNULL),STICK,COLORRED;


绿柱:IF(MACD<REF(MACD,1),MACD,DRAWNULL),STICK,COLORCYAN;


IF(DIF>=DEA,DIF,DRAWNULL),COLORRED;


IF(DIF<DEA,DIF,DRAWNULL),COLORGREEN;


RSV9:=IF((C-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13))>0.6,(H-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13)),(L-LLV(LOW,13))/(HHV(HIGH,13)-LLV(LOW,13)));


RSV27:=IF((C-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))>0.6,(H-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27)),(L-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27)));


K9:=SMA(RSV9,4,1);


K27:=SMA(RSV27,5,1);


D9:=SMA(K9,3,1);


D27:=SMA(K27,4,1);


短值:=(3*K9-2*D9)*100;


长值:=(3*K27-2*D27)*100;


趋势11:=(短值*1.2+长值*0.8)/2,COLORYELLOW,LINETHICK2;


秘密买点:=IF(趋势11<=-11,1,0),COLOR00FF00,LINETHICK3;


 


J1:=BARSLAST(REF(CROSS(DIF,DEA),1));   


J2:=BARSLAST(REF(CROSS(DEA,DIF),1));   


底背离:=REF(CLOSE,J1+1)>CLOSE AND DIF> REF(DIF,J1+1) AND CROSS(DIF,DEA) AND DIF<0.45;    


DRAWICON(底背离,DEA*1.3,1);  


DRAWTEXT(底背离,DEA*1.5,'底背离'),COLORWHITE; 


 


{DRAWTEXT(CROSS(DIF,DEA),DIF-0,'建仓'),COLORYELLOW;


DRAWTEXT(CROSS(DEA,DIF) AND DEA>0,DIF+0,'空仓'),COLORGREEN;}


 


{_抄底:ABS((CROSS("MACD.DIF","MACD.DEA")


&&"MACD.DEA"<=-0.07)*"MACD.DIF")*1.50,COLORLIMAGENTA;}


_DIF:="MACD.DIF",COLORGREEN;


_DEA:="MACD.DEA";


{__强度:IF(_DIF>_DEA,_DIF,DRAWNULL),COLORRED,LINETHICK1;}


_强度:IF(_DEA<_DIF,_DEA,DRAWNULL);


{DRAWTEXT(ABS(_抄底)>0,_抄底*1.20,' 抄底'),COLORYELLOW;


DRAWICON(ABS(_抄底)>0,_抄底*1.10,4);}


DRAWICON(CROSS(_DIF,_DEA),_DEA,1);


DRAWICON(CROSS(_DEA,_DIF),_DEA,2);


 


VAR1:=EMA(EMA(CLOSE,13),13);


控盘:=(VAR1-REF(VAR1,1))/REF(VAR1,1)*1000;


无庄控盘:=控盘<0;


有庄控盘:=控盘>REF(控盘,1) AND 控盘>0;


VAR2:=100*WINNER(CLOSE*0.95);


主力出货:=控盘<REF(控盘,1) AND 控盘>0;


A10:=CROSS(控盘,0);


控盘B:=FILTER(IF(A10,1,0),5);


高度控盘:= VAR2>50 AND COST(85)<CLOSE AND 控盘>0,COLOR00FFFF,LINETHICK2;


{分时价格原码}


JJ:=DYNAINFO(11);


{波段买卖原码}


P:=55;S:=8;M1:=3;


财:=(EMA(CLOSE,S)-EMA(CLOSE,P))*10,COLORRED,LINETHICK2;


神:=EMA(财,M1),COLORGREEN,LINETHICK1;


{股价与均线偏离买卖条件}


BTJ1:=(C-JJ)/JJ<-0.03;


BTJ11:=(C-JJ)/JJ<-0.03;


BTJ12:=LAST(JJ>=REF(JJ,1),5,1) AND (C-JJ)/JJ<0.005;


STJ1:=(C-JJ)/JJ>0.005;


{控盘买卖条件}


STJ01:=控盘<REF(控盘,1)  AND 控盘>0.5;


STJ02:=控盘>0;


BTJ2:=控盘>REF(控盘,1) AND 控盘<-0.2;


BTJ22:=控盘>REF(控盘,1) AND 控盘<0 ;


{波段买卖条件}


BTJ3:=CROSS(财,神) AND  财<-0.3;


BTJ32:=CROSS(财,神) AND  财<-0.1;


STJ31:=CROSS(神,财);


STJ32:=CROSS(神,财) AND  财>1.618;


{以下为信号};


BTJ81:=FILTER(BTJ1 AND BTJ2 AND BTJ3,13);


BTJ811:=FILTER(BTJ11 AND BTJ2 AND BTJ3,13);


BTJ82:=FILTER(BTJ12 AND BTJ22 AND BTJ32,13);


STJ81:=FILTER(STJ1 AND STJ01 AND STJ31,13);


STJ82:=FILTER(STJ02 AND STJ32 ,13);


STJ83:=STJ81 AND STJ82;


DIFF:= (EMA(CLOSE,8) - EMA(CLOSE,55))*10,COLORRED;


DEAA:= EMA(DIFF,3),COLORGREEN;


庄:= BTJ11 AND BTJ2 AND BTJ3;


有庄:=FILTER(庄,55);


DRAWTEXT(BTJ811,0,'主力'),COLORYELLOW;


 


A:=EMA(CLOSE,9)-EMA(CLOSE,18);


B:=EMA(A,7),LINETHICK1;


MACD1:=2*(A-B);


{STICKLINE(MACD>=0,MACD,0,0,0),COLORF00FF0;


STICKLINE(MACD<0,MACD,0,1,0),COLORF00FF0;


STICKLINE(MACD<REF(MACD,1)AND MACD>0,0,MACD,0,0 ),COLORFFFF00;


STICKLINE(MACD<=REF(MACD,1)AND MACD<0,0,MACD,1,0 ),COLORFFFF00; 


IF(A<0,A,0),COLORRED,LINETHICK1;


IF(A<0,0,A),COLORRED,LINETHICK1;


IF(A<B,A,B),COLOR00FF00,LINETHICK1;


IF(A>B,B,B),COLORWHITE,LINETHICK1;}


机会来临:=REF(IF((MA(C,5)-C)/C>0.04 AND (MA(C,10)-MA(C,5))/MA(C,5)>0.04,0.5,0),1),COLORGREEN;


LC:=REF(CLOSE,1); 


RSI:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;


E:=CROSS(83,RSI);


STICKLINE( E,0.45,0.6,1,0),COLORMAGENTA;


{DRAWTEXT(E,0.85,' 逃顶'),COLORGREEN;}


低位金叉:=CROSS(A,B) AND A<-0.1,COLORRED;


{STICKLINE(低位金叉,0,0.5,2,0),COLORRED;}


JCCOUNT:=COUNT(CROSS(A,B),BARSLAST(B>=0));


二次金叉:=CROSS(A,B) AND B<0 AND COUNT(JCCOUNT=2,21)=1;


{STICKLINE(二次金叉,0,0.2,2,0),COLORYELLOW;}


{DRAWICON(二次金叉,B*0.9,25) ;


DRAWTEXT(二次金叉,DEA*1.5,'二次金叉'),COLORCYAN;}


{DRAWICON(LLV(MACD,4)>0 AND MACD<REF(MACD,1) AND REF(MACD,1)>REF(MACD,2) AND REF(MACD,2)>REF(MACD,3),MACD,2);}


VAR777:=EMA(EMA(CLOSE,9),9);


控盘1:=(VAR777-REF(VAR777,1))/REF(VAR777,1)*1000;


A100:=CROSS(控盘1,0);


无庄控盘1:=IF(控盘1<0,控盘1,0),COLORWHITE,NODRAW;


开始控盘1:=IF(A100,1,0),LINETHICK1,COLORYELLOW;


AR1:=(HIGH+LOW+OPEN+2*CLOSE)/5;


AR2:=REF(AR1,1);


AR3:=SMA((CLOSE-AR2),6,1)/SMA(ABS(CLOSE-AR2),6,1)*100;


AR4:=(CLOSE-REF(OPEN,29))/REF(OPEN,29)*100;


AR5:=EMA(0.667*REF(AR4,1)+0.333*AR4,5);


AR61:=IF(VOL>=1.3*MA(VOL,5) AND COUNT(AR4>=AR5 AND AR4<-17,3) AND REF(LOW,1)=LLV(LOW,120),1,0);


AR71:=SMA(MAX(CLOSE-REF(C,1),0),6,1)/SMA(ABS(CLOSE-REF(C,1)),6,1)*100;


AR8:=SMA(MAX(AR1-AR2,0),10,1)/SMA(ABS(AR1-AR2),10,1)*100;


AR9:=IF(COUNT(AR8<20,5)>=1 AND COUNT(AR1=LLV(AR1,10),10)>=1 AND CLOSE>=OPEN*1.038 AND VOL>MA(VOL,5)*1.2,1,0);


DRAWTEXT(FILTER(AR9 OR AR61,5),DEA*0.9,'底'),COLORRED;

30-1G11R05P7.png

版权声明

本文版权归掌上指标所有。
未经许可,不得转载,转载请注明出处!

服务热线

18020657357

微信客服

微信客服