同花顺二次金叉公式
源码
M1:=3;M2:=5;M3:=7;M4:=13;M5:=15;M6:=21;
VAR1:=LLV(HIGH,240);
VAR2:=100*(CLOSE-VAR1)/VAR1;
VAR3:=(CLOSE-LLV(LOW,528))/(HHV(HIGH,528)-LLV(LOW,528))*100;
VAR4:=(CLOSE-LLV(CLOSE,530))/(HHV(CLOSE,530)-LLV(CLOSE,530))*100;
VAR5:=0;
VAR6:=SMA(MAX(CLOSE-REF(CLOSE,1),0),34,1)/
SMA(ABS(CLOSE-REF(CLOSE,1)),7,1)*100;
VAR7:=SMA(MAX(CLOSE-REF(CLOSE,1),0),13,1)/
SMA(ABS(CLOSE-REF(CLOSE,1)),13,1)*100;
VARA:=BARSCOUNT(CLOSE);
VARB:=VAR6<20 AND VAR7<23 AND VARA>35;
VARC:=VARB AND COUNT(VARB,1)=1;
VARD:=EMA(CLOSE,21)-EMA(CLOSE,8);
VARE:=EMA(VARD,5);
VARF:=TROUGHBARS(3,6,1)<4 AND CROSS(VARD,VARE);
VAR8:=IF(TROUGHBARS(3,16,1)=0 AND HIGH>LOW+0.04,4,0);
VAR9:=ZIG(3,6)>REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)<=REF(ZIG(3,6),2) AND
REF(ZIG(3,6),2)<=REF(ZIG(3,6),3);
VAR10:=ZIG(3,6)<REF(ZIG(3,6),1) AND REF(ZIG(3,6),1)>=REF(ZIG(3,6),2) AND
REF(ZIG(3,6),2)>=REF(ZIG(3,6),3);
VAR11:=ZIG(3,22)>REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)<=REF(ZIG(3,22),2)
AND REF(ZIG(3,22),2)<=REF(ZIG(3,22),3);
VAR12:=ZIG(3,22)<REF(ZIG(3,22),1) AND REF(ZIG(3,22),1)>=REF(ZIG(3,22),2)
AND REF(ZIG(3,22),2)>=REF(ZIG(3,22),3);
VAR13:=ZIG(3,51)>REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)<=REF(ZIG(3,51),2)
AND REF(ZIG(3,51),2)<=REF(ZIG(3,51),3);
VAR14:=ZIG(3,51)<REF(ZIG(3,51),1) AND REF(ZIG(3,51),1)>=REF(ZIG(3,51),2)
AND REF(ZIG(3,51),2)>=REF(ZIG(3,51),3);
VAR15:=ZIG(3,72)>REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)<=REF(ZIG(3,72),2)
AND REF(ZIG(3,72),2)<=REF(ZIG(3,72),3);
VAR16:=ZIG(3,72)<REF(ZIG(3,72),1) AND REF(ZIG(3,72),1)>=REF(ZIG(3,72),2)
AND REF(ZIG(3,72),2)>=REF(ZIG(3,72),3);
VAR17:=EMA(CLOSE,2)-EMA(CLOSE,150);
VAR1A:=EMA(VAR17,100);
VAR1B:=2*(VAR17-VAR1A);
VAR1C:=POW(VAR1B,3)*0.1+POW(VAR1B,1);
VAR1D:=SQRT(SQRT(LOW*HIGH*OPEN*CLOSE));
VAR1E:=EMA(VAR1D*0.97,3);
VAR1F:=(HIGH+LOW+CLOSE)/3;
VAR18:=(VAR1F-MA(VAR1F,14))/(0.015*AVEDEV(VAR1F,14));
VAR19:=CROSS(VAR1E,LOW);
选股买点:= VAR8,colorred;
组合买:=(VAR9+VAR11+VAR13+VAR15);
组合卖:=(VAR10+VAR12+VAR14+VAR16);
黑马线:=IF(YEAR<2098 AND VAR1B>0.1,VAR1C,0);
VAR20:=选股买点 AND VARF AND VARC AND VAR19 AND VAR2<0 AND VAR3=0
AND VAR4=0 AND VAR18<(-110);
DRAWTEXT(VAR11,LOW,'●介入'),colormagenta , LINETHICK4;
STICKLINE(组合买,CLOSE,OPEN,1,0),colorblue;
DRAWTEXT(组合买,LOW,'B'),colorgreen;
STICKLINE(组合卖,CLOSE,OPEN,1,0),colorgreen;
DRAWTEXT(组合卖,HIGH,'S'),coloryellow;
STICKLINE(选股买点,CLOSE,OPEN,1,0),colorblue;
DRAWTEXT(选股买点>0,LOW,'B'),colormagenta;
DRAWTEXT(VAR14,HIGH,'空仓'), LINETHICK3, colorcyan;
DRAWTEXT(VAR18<-110 AND 选股买点>0,LOW,'买入'),colorred ,
LINETHICK3 ;
VAA1:=(ZIG(3,10) < REF(ZIG(3,10),1)) AND (REF(ZIG(3,10),1) > REF(ZIG(3,10),2));
VAA2:=(ZIG(3,10) > REF(ZIG(3,10),1)) AND (REF(ZIG(3,10),1) < REF(ZIG(3,10),2));
DRAWTEXT(VAA1,HIGH,'卖出'),coloryellow;
DRAWTEXT(VAA2 AND (DATE < 1070804),LOW,'买入'),coloryellow;
STICKLINE(VAA1 AND (DATE < 1070804),CLOSE,OPEN,1.5,0),coloryellow;
STICKLINE(VAA1 AND (DATE < 1070804),HIGH,LOW,1.5,0),coloryellow;
STICKLINE(VAA2 AND (DATE < 1070804),CLOSE,OPEN,1.5,0),COLORFF00FF;
STICKLINE(VAA2 AND (DATE < 1070804),HIGH,LOW,1.5,0),COLORFF00FF;
周线:MA(CLOSE,M1),colorwhite;
半月线:MA(CLOSE,M2),coloryellow;
月线:MA(CLOSE,M3),colormagenta;
季度线:MA(CLOSE,M4),colorgreen;
半年线:MA(CLOSE,M5),colorcyan;
年线:MA(CLOSE,M6),colorblue;
A:=BARSCOUNT(C);
AH:=HHV(H,200);
AL:=LLV(L,200);
A0:=(AH-AL)/40;
B1:=L-A0;
STICKLINE((A+0)/34=FLOOR((A+0)/34),B1,B1-1.5*A0,3,0),COLORF00FF0;
DRAWTEXT((A+0)/34=FLOOR((A+0)/34),B1-1*A0,'时间窗'),colorwhite;
X1:=(C+L+H)/3;BB13:=ATAN(EMA(X1,13)-REF(EMA(X1,13),1))*3.1416*10;
SQX:=(C-MA(CLOSE,13))*100;
DIFF:EMA(MA(SQX,7),1),COLOR00FFFF;
DEA:EMA(DIFF,7),COLORFF33FF;MACD:(DIFF-DEA)*2,COLORSTICK;
低位金叉:IF(CROSS(DIFF,DEA) AND DIFF<-0.1,0.3,0),coloryellow,POINTDOT;
STICKLINE(低位金叉,0,15,8,0),coloryellow;DRAWICON(低位金叉,0.3,1);
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:IF(CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1,0.2,0),COLORFF00FF,POINTDOT;
STICKLINE(二次金叉,30,15,8,0),COLORFF00FF;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:IF(REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA),0.1,0),colorred,POINTDOT;
STICKLINE(底背离,45,30,8,0),colorred;DRAWLINE(A1=0,DEA,底背离,DEA,0),colorred;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:REF(CLOSE,A2+1)<CLOSE AND REF(DIFF,A2+1)>DIFF AND CROSS(DEA,DIFF),colorgreen;
DRAWLINE(A2=0,DEA,顶背离,DEA,0),colorgreen;
A3:=CROSS(DIFF,DEA) AND DEA<0;
零下二次金叉:IF(FILTER(COUNT(A3,21)=2,10),0.05,0),colorwhite,POINTDOT;
STICKLINE(零下二次金叉,45,60,8,0),colorwhite;
DRAWTEXT(CROSS(DIFF,DEA),DIFF,'始');
DRAWTEXT(CROSS(DEA,DIFF),DEA,'终');