{多空因子趋势跟踪}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
M5F:=MA(C,4);
M10F:=MA(C,8),COLORRED,LINETHICK2;
M20F:=MA(C,20);
M30F:=MA(C,30);
M60F:=MA(C,60),COLORBLUE,LINETHICK2;
D3:=MIN(MIN(M5F,M10F),M20F)>M60F;
LLM:=LLV(MACD*100,200);
HHM:=HHV(MACD*100,200);
TJA:=C>REF(C,1)*1.05;
T:=BARSLAST(C>REF(C,1)*1.095 AND C=H);
T2L:=BARSLAST(C< REF(C,1)*1.095 AND C>REF(C,1)*1.08);
T3L:=BARSLAST(C< REF(C,1)*1.08 AND C>REF(C,1)*1.07);
T4L:=BARSLAST(C< REF(C,1)*1.07 AND C>REF(C,1)*1.06);
T5L:=BARSLAST(C< REF(C,1)*1.06 AND C>REF(C,1)*1.05);
AAF1:=REF(T,1)>100 AND REF(T2L,1)>100 AND REF(T3L,1)>100 AND REF(T4L,1)>100 AND REF(T5L,1)>80 AND TJA;
XGT:=BARSLAST(AAF1 AND HHM< 60 AND LLM>-55);
DJZ:=REF(HHV(H,100),3);
D6:=BARSSINCEN(MIN(MIN(M5F,M10F),M20F)>M60F,XGT+1);
XGX:=CROSS((XGT=0 AND D3) OR D6=0,0.5);
TJJ:=COUNT(XGX,30)=2 AND XGX;
SR1:=REF(HIGH,10)=HHV(HIGH,2*10+1);
SR2:=FILTER(SR1,10);
SR3:=REF(SR2,10+1);
HDF:=REF(SR3,10);
前高:=REF(H,BARSLAST(HDF));
倍量:=VOL/REF(VOL,1)>=1.9;
突破前高:=CROSS(C,前高);
YG:= 倍量 AND 突破前高;
低2:=IF(CURRBARSCOUNT<=60, CONST(IF(ISLASTBAR=1,LLV(L, BARSLAST(CURRBARSCOUNT=60)),1)),DRAWNULL);
SJ:=BARSLAST(YG);
H300:=HHVBARS(DIF,300);
BOLL:=MA(CLOSE,20);
AL:=BOLL+2*STD(CLOSE,20);
TQ:=BARSLAST(CROSS(AL>=REF(AL,1),0.5));
E25:=EXPMA(C,25);
ZDZ:=REFDATE(DJZ,DATE);
ZF:=EVERY(RANGE(C/REF(C,1),0.97,1.05),TQ+1);
ZFF:=(HHV(H,TQ+1)-LLV(L,TQ+1))/LLV(L,TQ+1)*100;
TJQ:=EVERY(MAX(C,O)/AL< 1.02 ,TQ+1);
XL:=(ATAN((E25/REF(E25,TQ)-1)*100)*180/3.1415926);
DJ:=REF(LLV(L,100),3);
TJ1Q:=CROSS(DIF>=REF(DIF,H300),0.5) AND ZFF< 17 AND ZF AND TJQ;
躁动:=TJ1Q AND XL>75;
A1F:=REF(C,1);
AYFF:=REF(C,10);
A31F:=(AYFF-A1F)/A1F*100;
AA1F:=(A31F-REF(A31F,1));
选股1:=CROSS(AAF1,9.8);
A11F:=REF(V,1);
VAR8:=IF(VOL>0.001,1,EXP(ABS(LOG(VOL*100))))>2;
A13F:=VAR8/A11F;
AA3F:=(A13F-REF(A13F,1));
选股2:=CROSS(AA3F,500);
潜伏2:=选股1 AND 选股2;
GX:=潜伏2 OR 躁动 OR CURRBARSCOUNT=CONST(SJ)+2 OR TJJ OR (CCI<=100 AND L<=低2);
YF:=FILTER(GX=1,3);
A2A:=BARSCOUNT(C);
AH:=HHV(H,200);
A1L:=LLV(L,200);
A0:=(AH-A1L)/190;
B1F:=L-A0;
LC:=REF(CLOSE,1);
Z1:=SMA(MAX(CLOSE-LC,0),10,1)/SMA(ABS(CLOSE-LC),10,1)*100;
LJ2:=REF(LOW,1);
XH:=H=ZDZ;
LJ3:=SMA(ABS(LOW-LJ2),13,1)/SMA(MAX(LOW-LJ2,0),13,1)*100;
LJ4:=EMA(IF(CLOSE*1.2,LJ3*13,LJ3/13),13);
LJ5:=LLV(LOW,34);
LJ6:=HHV(LJ4,34);
LJ7:=IF(LLV(LOW,56),1,0);
LJ8:=EMA(IF(LOW<=LJ5,(LJ4+LJ6*2)/2,0),3)/618*LJ7;
AA:=LJ8>REF(LJ8,1);
DR:=100;
ZRQ:=3;
ZD:=REFDATE(DJ,DATE);
ZZ:=L=ZD;
XGA:=AA AND ZZ,COLORRED,LINETHICK2;
XG1:=XGA>REF(XGA,1);
ZT:=XG1>REF(XG1,1)COLORRED,LINETHICK2;
{DRAWTEXT(CROSS(Z1,20),L,'底'),COLORRED;
DRAWTEXT(CROSS(80,Z1),H,'顶'),COLORGREEN;
DRAWTEXT(YF,L,'准备'),COLORYELLOW;
DRAWTEXT(ZT,H,'起爆'),COLORLIRED;
DRAWTEXT(XH,H,'到顶'),COLORGREEN;}
M3:=MA(CLOSE,3);
M10:=MA(CLOSE,10);
DRAWBAND(M10,RGB(0,324,324),M3,RGB(200,96,96));
MA1:=MA(C,1),COLORFFFF00,NODRAW;
MA30:=MA(C,30),COLORFFFF00,NODRAW;
A20:3*MA30-2*MA1,COLOR888888;
A18:2.8*MA30-1.8*MA1,COLOR777777;
A16:2.6*MA30-1.6*MA1,COLOR666666;
A14:2.4*MA30-1.4*MA1,COLOR656565;
A12:2.2*MA30-1.2*MA1,COLOR555555;
A10:2*MA30-1*MA1,COLOR454545;
A8:1.8*MA30-0.8*MA1,COLOR444444;
A6:1.6*MA30-0.6*MA1,COLOR353535;
A4:1.4*MA30-0.4*MA1,COLOR333333;
A1:1.1*MA30-0.1*MA1,COLOR353535,LINETHICK1;
MMV:=EMA(((SLOPE(CLOSE,22) * 20) + CLOSE),55);
MM:=(IF(((PERIOD > 5) AND (PERIOD < 9)),MA(MMV,1),IF((PERIOD = 5), MA(MMV,4),IF((PERIOD = 4),MA(MMV,8),IF((PERIOD = 3),MA(MMV,16), IF((PERIOD = 2),MA(MMV,32),0))))) );
SSL:=EMA(CLOSE,3);
STICKLINE(A1>A20,A20,A1,0,0),COLOR333333;
STICKLINE(A1< A20,A20,A1,0,0),COLOR333333;
X_1:=(C+0.809*H+0.618*L+O/2)/2.927;
MA_5:=MA(X_1,5),LINETHICK3;
SMA_5:=SMA(C,5,1);
DMA_H:=DMA(SMA_5,VOL/SUM(VOL,COUNT(C>0,0))*100);
AGQ_D3:=SMA(DMA_H,3,1) ;
AGQ_D5:=SMA(DMA_H,5,1);
AGQ_D7:=SMA(DMA_H,7,1);
AGQ_D9:=SMA(DMA_H,9,1);
AGQ_D11:=SMA(DMA_H,11,1);
IF(AGQ_D3< REF(AGQ_D3,1),AGQ_D3,DRAWNULL),POINTDOT,COLORFFAA11;
IF(AGQ_D5< REF(AGQ_D5,1),AGQ_D5,DRAWNULL),POINTDOT,COLORFFBB33;
IF(AGQ_D7< REF(AGQ_D7,1),AGQ_D7,DRAWNULL),POINTDOT,COLORFFCC55;
IF(AGQ_D9< REF(AGQ_D9,1),AGQ_D9,DRAWNULL),POINTDOT,COLORFFDD66;
IF(AGQ_D11< REF(AGQ_D11,1),AGQ_D11,DRAWNULL),POINTDOT,COLORFFEE55;
IF(AGQ_D3>REF(AGQ_D3,1),AGQ_D3,DRAWNULL),POINTDOT,COLORFF00FF;
IF(AGQ_D5>REF(AGQ_D5,1),AGQ_D5,DRAWNULL),POINTDOT,COLORFF99FF;
IF(AGQ_D7>REF(AGQ_D7,1),AGQ_D7,DRAWNULL),POINTDOT,COLORFF66FF;
IF(AGQ_D9>REF(AGQ_D9,1),AGQ_D9,DRAWNULL),POINTDOT,COLORFF33FF;
IF(AGQ_D11>REF(AGQ_D11,1),AGQ_D11,DRAWNULL),POINTDOT,COLORFF66FF;
AGQ_3:(3*MA_5+2*REF(MA_5,1)+REF(MA_5,2))/(1+2+3),COLOR00AA00,LINETHICK1;
AGQ_5:(5*MA_5+4*REF(MA_5,1)+3*REF(MA_5,2)+2*REF(MA_5,3)+REF(MA_5,4))/(5+4+3+2+1),COLOR00BB00,LINETHICK1;
AGQ_7:(7*MA_5+6*REF(MA_5,1)+5*REF(MA_5,2)+4*REF(MA_5,3)+3*REF(MA_5,4)+2*REF(MA_5,5)+REF(MA_5,6))/(7+6+5+4+3+2+1),COLOR00CC00,LINETHICK1;
AGQ_9:(9*MA_5+8*REF(MA_5,1)+7*REF(MA_5,2)+6*REF(MA_5,3)+5*REF(MA_5,4)+4*REF(MA_5,5)+3*REF(MA_5,6)+2*REF(MA_5,7)+REF(MA_5,8))/(9+8+7+6+5+4+3+2+1),COLOR00DD00,LINETHICK1;
AGQ_11:(11*MA_5+10*REF(MA_5,1)+9*REF(MA_5,2)+8*REF(MA_5,3)+7*REF(MA_5,4)+6*REF(MA_5,5)+5*REF(MA_5,6)+4*REF(MA_5,7)+3*REF(MA_5,8)+2*REF(MA_5,9)+REF(MA_5,10))/(11+10+9+8+7+6+5+4+3+2+1),COLOR00EE00,LINETHICK1;
IF(AGQ_3>REF(AGQ_3,1),AGQ_3,DRAWNULL),COLOR0000AA,LINETHICK1;
IF(AGQ_5>REF(AGQ_5,1),AGQ_5,DRAWNULL),COLOR0000BB,LINETHICK1;
IF(AGQ_7>REF(AGQ_7,1),AGQ_7,DRAWNULL),COLOR0000CC,LINETHICK1;
IF(AGQ_9>REF(AGQ_9,1),AGQ_9,DRAWNULL),COLOR0000DD,LINETHICK1;
IF(AGQ_11>REF(AGQ_11,1),AGQ_11,DRAWNULL),COLOR0000EE,LINETHICK1;
STICKLINE(CLOSE>OPEN OR CLOSE=OPEN AND CLOSE>REF(CLOSE,1),LOW,HIGH,0,0),COLORRED;
STICKLINE(CLOSE>OPEN OR CLOSE=OPEN AND CLOSE>REF(CLOSE,1),OPEN,CLOSE,3,0),COLORRED;
STICKLINE(CLOSE< OPEN OR CLOSE=OPEN AND CLOSE<=REF(CLOSE,1),LOW,HIGH,0,0),COLORFFFF00;
STICKLINE(CLOSE< OPEN OR CLOSE=OPEN AND CLOSE<=REF(CLOSE,1),OPEN,CLOSE,3,0),COLORFFFF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,0,0 ),COLORFFFF00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,3,0 ),COLORFFFF00;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,0,1) ,COLORRED;
STICKLINE(CLOSE>OPEN,CLOSE,OPEN,3,1) ,COLORRED;
DRAWTEXT(CROSS(Z1,20),L,'底'),COLORRED;
DRAWTEXT(CROSS(80,Z1),H,'顶'),COLORGREEN;
DRAWTEXT(YF,L,'准备'),COLORYELLOW;
DRAWTEXT(ZT,H,'起爆'),COLORLIRED;
DRAWTEXT(XH,H,'到顶'),COLORGREEN;