同花顺MACD变色V4公式
源码
金叉买入指标公式
//MACD变色V4 +金叉买入指标公式 20150905
//20150328 DIFF上穿0轴后在0轴上第一次死叉后又金叉
//20150329 MACD多头二次翻红
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26),colorwhite,LINETHICK1;
DEA: EMA(DIFF,9),coloryellow,LINETHICK1;
MACD: 2*(DIFF-DEA),colorred,NODRAW;
Zero: 0,colorff7f00,LINETHICK1;
LL:=MAX(MAX(DIFF,DEA),MACD)*1.1+0.1;
//潜在高转送次新股:每股资本公积+每股未分配利润>5元,净资产收益率>10%,流通市值<50亿
流通股:SHGZG/10000/10000,coloryellow,NODRAW;
资本公积:GJJ/ZGB,colorgreen,NODRAW;
利润:WFPLR/ZGB,2,colormagenta,NODRAW;
净资产:MGJZC,2,colorff7f00,NODRAW;
角度:((ATAN((C - REF(C,1))) * 3.14159) * 10),colorcyan,NODRAW;
偏离度:(EMA(C,5)-EMA(C,55)),color00aaff,NODRAW;
MA5:=MA(C,5);MA10:=MA(C,10);MA20:=MA(C,20);MA30:=MA(C,30);MA60:=MA(C,60);
二线多头排列:= MA5>=MA10;
三线多头排列1:= MA5>=MA10 AND MA10>=MA20;
三线多头排列2:= MA5>=MA10 AND MA10>=MA30;
三线多头排列3:= MA10>=MA20 AND MA20>=MA30;
四线多头排列:= MA5>=MA10 AND MA10>=MA20 AND MA20>=MA30;
N:=0.2;
广义四线多头排列:= 四线多头排列 OR (三线多头排列1 AND MA30-MA20<N) OR (三线多头排列2 AND MA20-MA10<N) OR (三线多头排列3 AND MA10-MA5<N);
N:=0.6;
广义四线多头排列1:= 四线多头排列 OR (三线多头排列1 AND MA30-MA20<N) OR (三线多头排列2 AND MA20-MA10<N) OR (三线多头排列3 AND MA10-MA5<N);
//CCI抄底
//N:=14;
//TYP := (IF(ISNULL(HIGH),CLOSE,HIGH) + IF(ISNULL(LOW),CLOSE,LOW) + CLOSE)/3;
//CCI: (TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),colorffff00,NODRAW;
//红色
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),color0000ff;
//墨绿
STICKLINE(MACD>0 AND MACD<REF(MACD,1),0,MACD,2,0),colorffff00;
//洋红
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),colorff00ff;
//绿色
STICKLINE(MACD<0 AND MACD<REF(MACD,1),0,MACD,2,0),color00ff00;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.2;
//贴近零轴金叉:=CROSS(DIFF,DEA) AND MACD>0 AND BETWEEN(DIFF,-0.03,0.03);
//DRAWTEXT(贴近零轴金叉 AND 广义四线多头排列1,DIFF*1.1,'⊕'),colormagenta;
四线少头:=MA5<=MA10 AND MA10<=MA20 AND MA20<=MA30;
四线多头:=MA5>=MA10 AND MA10>=MA20 AND MA20>=MA30;
三线少头:=((MA5<=MA10 AND MA10<=MA20) OR (MA10<=MA20 AND MA20<=MA30)) AND NOT(四线少头);
三线多头:=((MA5>=MA10 AND MA10>=MA20) OR (MA10>=MA20 AND MA20>=MA30)) AND NOT(四线多头);
多头排列:=四线多头 OR 三线多头;
少头排列:=四线少头 OR (三线少头 AND MA30<MA60);
//LL:=IF(MACD>=0,IF(MACD<=0.5,1,MACD*1.1),DIFF*1.1);
A1:=CROSS(DIFF,DEA) AND MACD>0 AND BETWEEN(DIFF,-0.2,0.2);
A2:=(多头排列 OR 少头排列) AND (MA5>REF(MA5,1));
A3:=1;
贴近零轴金叉:=A1 AND A2 AND A3;
DRAWTEXT(贴近零轴金叉,LL,'⑧'),colormagenta;
AA:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
一次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=1,21)=1;
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
三次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=3,21)=1;
四次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=4,21)=1;
五次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=5,21)=1;
六次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=6,21)=1;
//VERLINE(二次金叉,1),colorwhite;
DRAWTEXT(一次金叉,DIFF*1.1,'①'),color00aaff;
DRAWTEXT(一次金叉 AND 低位金叉,DIFF*1.1,'①低位'),color00aaff;
DRAWTEXT(二次金叉,DIFF*1.1,'②'),color00aaff;
DRAWTEXT(二次金叉 AND 低位金叉,DIFF*1.1,'②低位'),color00aaff;
DRAWTEXT(三次金叉,DIFF*1.1,'③'),color00aaff;
DRAWTEXT(三次金叉 AND 低位金叉,DIFF*1.1,'③低位'),color00aaff;
DRAWTEXT(四次金叉,DIFF*1.1,'④'),color00aaff;
DRAWTEXT(四次金叉 AND 低位金叉,DIFF*1.1,'④低位'),color00aaff;
DRAWTEXT(五次金叉,DIFF*1.1,'⑤'),color00aaff;
DRAWTEXT(五次金叉 AND 低位金叉,DIFF*1.1,'⑤低位'),color00aaff;
DRAWTEXT(六次金叉,DIFF*1.1,'⑥'),color00aaff;
DRAWTEXT(六次金叉 AND 低位金叉,DIFF*1.1,'⑥低位'),color00aaff;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A1=0,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWLINE(底背离,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWTEXT(底背离,REF(DEA,A1)*1.28,'+底背离'),COLORFF00FF;
DRAWLINE(A2=0 ,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.18,'-顶背离'),colorgreen,LINETHICK2;
//DIFF上穿0轴后在0轴上第一次死叉后又金叉
A1:= CROSS(DIFF,DEA) AND DEA>0 ;
A2:=BARSLAST(CROSS(DEA,DIFF)) AND DEA>0;
A3:=REF(BARSLAST(CROSS(DIFF,0))<20,BARSLAST(CROSS(DEA,DIFF))+1);
//N:= ABS(MAX(DIFF,DEA))+1;
MACD死叉后金叉:= A1 AND A2 AND A3;
//这个"二次翻红"指标除了满足原有的四个条件外,即:
//一是MACD在零轴以上并且第二次收红柱;
//二是MACD红柱大于等于零轴并且红柱缩短小于0.10以下;(实战0.111也行)
//三是DIFF与DEA两线的粘合度小于0.018;
//四是红柱连续缩短三天以上。www.guhai.com.cn
//还基本满足了所描述的四个条件(即:
//1、30日移动平均线由下跌变为走平或翘头向上,5日、10、30日移动平均线刚刚形成多头排列;
//2、日K线刚刚上穿30日移动平均线或在30日移动平均线上方运行;
//3、DIF在零轴下方与MACD金叉后可靠意义将会更大,在第一次翻红后,红柱开始缩短,越短越好,最好不要超过0轴的第一横线;
//4、成交量由萎缩逐渐放大,特别是在二次翻红后,若能得到成交量的配合,该股后市向上冲击的力量会更大。)
//该指标没有设计成交量这个条件。只要符合所涉及到的条件,就能在"二次翻红"起涨点选出股票。
//MACD多头二次翻红
A1:=REF(MACD,1)<REF(MACD,2) AND REF(MACD,2)<REF(MACD,3) AND REF(MACD,3)<REF(MACD,4);
A2:=MACD>=0 AND COUNT(MACD>REF(MACD,1),1)=1;
A3:=EMA(C,30)>=REF(EMA(C,30),1) AND COUNT(EMA(C,5)>EMA(C,10) AND EMA(C,10)>EMA(C,30),1)=1;
A4:=CROSS(C,EMA(C,30)) OR C>EMA(C,30);
A5:=A1 AND A2 AND A3 AND A4;
A6:=A5 AND ABS((DIFF-DEA)/C)<0.018;
A7:=A5 AND MACD<0.10;
MACD多头二次翻红:=A5 OR A6 OR A7;
N:=MACD死叉后金叉 AND MACD多头二次翻红;
DRAWTEXT(N,LL,'③'),colorred;
DRAWTEXT(N AND 广义四线多头排列1,LL,'③'),colormagenta;
DRAWTEXT(MACD多头二次翻红 AND NOT(N),LL,'②'),colorred;
DRAWTEXT(MACD多头二次翻红 AND NOT(N) AND 广义四线多头排列1,LL,'②'),colormagenta;
DRAWTEXT(MACD死叉后金叉 AND NOT(N),LL,'①'),colorred;
DRAWTEXT(MACD死叉后金叉 AND NOT(N) AND 广义四线多头排列1,LL,'①'),colormagenta;
//两均线粘合多头排列-天线涨停
A1:=(MAX(MA5,MA10)-MIN(MA5,MA10))/MIN(MA5,MA10)*100<0.3;
A2:=MA10>MA20 AND MA20>MA30;
A3:=MACD>0 AND MACD<0.1;
//类十字星
A4:=ABS(C-O)/O<0.045 AND ABS(C-O)/(H-L)<0.96;
A5:=MIN(MA5,MA10)>MAX(C,O);
N:=A1 AND A2 AND A3 AND A4 AND A5;
DRAWTEXT(N,LL-0.3,'涨'),colorred;
移动端首页 | PC端
© by Gszb.com Mobile Web
同花顺MACD变色V4公式
源码
金叉买入指标公式
//MACD变色V4 +金叉买入指标公式 20150905
//20150328 DIFF上穿0轴后在0轴上第一次死叉后又金叉
//20150329 MACD多头二次翻红
DIFF:EMA(CLOSE,12) - EMA(CLOSE,26),colorwhite,LINETHICK1;
DEA: EMA(DIFF,9),coloryellow,LINETHICK1;
MACD: 2*(DIFF-DEA),colorred,NODRAW;
Zero: 0,colorff7f00,LINETHICK1;
LL:=MAX(MAX(DIFF,DEA),MACD)*1.1+0.1;
//潜在高转送次新股:每股资本公积+每股未分配利润>5元,净资产收益率>10%,流通市值<50亿
流通股:SHGZG/10000/10000,coloryellow,NODRAW;
资本公积:GJJ/ZGB,colorgreen,NODRAW;
利润:WFPLR/ZGB,2,colormagenta,NODRAW;
净资产:MGJZC,2,colorff7f00,NODRAW;
角度:((ATAN((C - REF(C,1))) * 3.14159) * 10),colorcyan,NODRAW;
偏离度:(EMA(C,5)-EMA(C,55)),color00aaff,NODRAW;
MA5:=MA(C,5);MA10:=MA(C,10);MA20:=MA(C,20);MA30:=MA(C,30);MA60:=MA(C,60);
二线多头排列:= MA5>=MA10;
三线多头排列1:= MA5>=MA10 AND MA10>=MA20;
三线多头排列2:= MA5>=MA10 AND MA10>=MA30;
三线多头排列3:= MA10>=MA20 AND MA20>=MA30;
四线多头排列:= MA5>=MA10 AND MA10>=MA20 AND MA20>=MA30;
N:=0.2;
广义四线多头排列:= 四线多头排列 OR (三线多头排列1 AND MA30-MA20<N) OR (三线多头排列2 AND MA20-MA10<N) OR (三线多头排列3 AND MA10-MA5<N);
N:=0.6;
广义四线多头排列1:= 四线多头排列 OR (三线多头排列1 AND MA30-MA20<N) OR (三线多头排列2 AND MA20-MA10<N) OR (三线多头排列3 AND MA10-MA5<N);
//CCI抄底
//N:=14;
//TYP := (IF(ISNULL(HIGH),CLOSE,HIGH) + IF(ISNULL(LOW),CLOSE,LOW) + CLOSE)/3;
//CCI: (TYP-MA(TYP,N))/(0.015*AVEDEV(TYP,N)),colorffff00,NODRAW;
//红色
STICKLINE(MACD>0 AND MACD>=REF(MACD,1),0,MACD,2,0),color0000ff;
//墨绿
STICKLINE(MACD>0 AND MACD<REF(MACD,1),0,MACD,2,0),colorffff00;
//洋红
STICKLINE(MACD<0 AND MACD>=REF(MACD,1),0,MACD,2,0),colorff00ff;
//绿色
STICKLINE(MACD<0 AND MACD<REF(MACD,1),0,MACD,2,0),color00ff00;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.2;
//贴近零轴金叉:=CROSS(DIFF,DEA) AND MACD>0 AND BETWEEN(DIFF,-0.03,0.03);
//DRAWTEXT(贴近零轴金叉 AND 广义四线多头排列1,DIFF*1.1,'⊕'),colormagenta;
四线少头:=MA5<=MA10 AND MA10<=MA20 AND MA20<=MA30;
四线多头:=MA5>=MA10 AND MA10>=MA20 AND MA20>=MA30;
三线少头:=((MA5<=MA10 AND MA10<=MA20) OR (MA10<=MA20 AND MA20<=MA30)) AND NOT(四线少头);
三线多头:=((MA5>=MA10 AND MA10>=MA20) OR (MA10>=MA20 AND MA20>=MA30)) AND NOT(四线多头);
多头排列:=四线多头 OR 三线多头;
少头排列:=四线少头 OR (三线少头 AND MA30<MA60);
//LL:=IF(MACD>=0,IF(MACD<=0.5,1,MACD*1.1),DIFF*1.1);
A1:=CROSS(DIFF,DEA) AND MACD>0 AND BETWEEN(DIFF,-0.2,0.2);
A2:=(多头排列 OR 少头排列) AND (MA5>REF(MA5,1));
A3:=1;
贴近零轴金叉:=A1 AND A2 AND A3;
DRAWTEXT(贴近零轴金叉,LL,'⑧'),colormagenta;
AA:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
一次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=1,21)=1;
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=2,21)=1;
三次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=3,21)=1;
四次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=4,21)=1;
五次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=5,21)=1;
六次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(AA=6,21)=1;
//VERLINE(二次金叉,1),colorwhite;
DRAWTEXT(一次金叉,DIFF*1.1,'①'),color00aaff;
DRAWTEXT(一次金叉 AND 低位金叉,DIFF*1.1,'①低位'),color00aaff;
DRAWTEXT(二次金叉,DIFF*1.1,'②'),color00aaff;
DRAWTEXT(二次金叉 AND 低位金叉,DIFF*1.1,'②低位'),color00aaff;
DRAWTEXT(三次金叉,DIFF*1.1,'③'),color00aaff;
DRAWTEXT(三次金叉 AND 低位金叉,DIFF*1.1,'③低位'),color00aaff;
DRAWTEXT(四次金叉,DIFF*1.1,'④'),color00aaff;
DRAWTEXT(四次金叉 AND 低位金叉,DIFF*1.1,'④低位'),color00aaff;
DRAWTEXT(五次金叉,DIFF*1.1,'⑤'),color00aaff;
DRAWTEXT(五次金叉 AND 低位金叉,DIFF*1.1,'⑤低位'),color00aaff;
DRAWTEXT(六次金叉,DIFF*1.1,'⑥'),color00aaff;
DRAWTEXT(六次金叉 AND 低位金叉,DIFF*1.1,'⑥低位'),color00aaff;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF);
DRAWLINE(A1=0,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWLINE(底背离,DEA,底背离,REF(DEA,A1),0),colorred,LINETHICK2;
DRAWTEXT(底背离,REF(DEA,A1)*1.28,'+底背离'),COLORFF00FF;
DRAWLINE(A2=0 ,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWLINE(顶背离,DEA,顶背离,REF(DEA,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(顶背离,REF(DEA,A2)*1.18,'-顶背离'),colorgreen,LINETHICK2;
//DIFF上穿0轴后在0轴上第一次死叉后又金叉
A1:= CROSS(DIFF,DEA) AND DEA>0 ;
A2:=BARSLAST(CROSS(DEA,DIFF)) AND DEA>0;
A3:=REF(BARSLAST(CROSS(DIFF,0))<20,BARSLAST(CROSS(DEA,DIFF))+1);
//N:= ABS(MAX(DIFF,DEA))+1;
MACD死叉后金叉:= A1 AND A2 AND A3;
//这个"二次翻红"指标除了满足原有的四个条件外,即:
//一是MACD在零轴以上并且第二次收红柱;
//二是MACD红柱大于等于零轴并且红柱缩短小于0.10以下;(实战0.111也行)
//三是DIFF与DEA两线的粘合度小于0.018;
//四是红柱连续缩短三天以上。www.guhai.com.cn
//还基本满足了所描述的四个条件(即:
//1、30日移动平均线由下跌变为走平或翘头向上,5日、10、30日移动平均线刚刚形成多头排列;
//2、日K线刚刚上穿30日移动平均线或在30日移动平均线上方运行;
//3、DIF在零轴下方与MACD金叉后可靠意义将会更大,在第一次翻红后,红柱开始缩短,越短越好,最好不要超过0轴的第一横线;
//4、成交量由萎缩逐渐放大,特别是在二次翻红后,若能得到成交量的配合,该股后市向上冲击的力量会更大。)
//该指标没有设计成交量这个条件。只要符合所涉及到的条件,就能在"二次翻红"起涨点选出股票。
//MACD多头二次翻红
A1:=REF(MACD,1)<REF(MACD,2) AND REF(MACD,2)<REF(MACD,3) AND REF(MACD,3)<REF(MACD,4);
A2:=MACD>=0 AND COUNT(MACD>REF(MACD,1),1)=1;
A3:=EMA(C,30)>=REF(EMA(C,30),1) AND COUNT(EMA(C,5)>EMA(C,10) AND EMA(C,10)>EMA(C,30),1)=1;
A4:=CROSS(C,EMA(C,30)) OR C>EMA(C,30);
A5:=A1 AND A2 AND A3 AND A4;
A6:=A5 AND ABS((DIFF-DEA)/C)<0.018;
A7:=A5 AND MACD<0.10;
MACD多头二次翻红:=A5 OR A6 OR A7;
N:=MACD死叉后金叉 AND MACD多头二次翻红;
DRAWTEXT(N,LL,'③'),colorred;
DRAWTEXT(N AND 广义四线多头排列1,LL,'③'),colormagenta;
DRAWTEXT(MACD多头二次翻红 AND NOT(N),LL,'②'),colorred;
DRAWTEXT(MACD多头二次翻红 AND NOT(N) AND 广义四线多头排列1,LL,'②'),colormagenta;
DRAWTEXT(MACD死叉后金叉 AND NOT(N),LL,'①'),colorred;
DRAWTEXT(MACD死叉后金叉 AND NOT(N) AND 广义四线多头排列1,LL,'①'),colormagenta;
//两均线粘合多头排列-天线涨停
A1:=(MAX(MA5,MA10)-MIN(MA5,MA10))/MIN(MA5,MA10)*100<0.3;
A2:=MA10>MA20 AND MA20>MA30;
A3:=MACD>0 AND MACD<0.1;
//类十字星
A4:=ABS(C-O)/O<0.045 AND ABS(C-O)/(H-L)<0.96;
A5:=MIN(MA5,MA10)>MAX(C,O);
N:=A1 AND A2 AND A3 AND A4 AND A5;
DRAWTEXT(N,LL-0.3,'涨'),colorred;