N:=10;
P:=3;
{背景位置 }
TT:=IF(ISLASTBAR,240/FROMOPEN,1);
NN:=120;
HH:=HHV(V*TT,NN);
LL:=LLV(V,NN);
最高:=CONST(HH);
最低:=CONST(LL);
最高2:=CONST(HHV(H,NN));
最低2:=CONST(LLV(L,NN));
PP:=IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,20)),0.9,IF((最高2*0.9-(最高2-最低2)*0.5)>CONST(LLV(L,50)),0.7,0.6)),NODRAW;
RCC1:=最高2*0.9-(最高2-最低2)*PP;
最低R:=MIN(RCC1,最低2);
RCC:=最低R;
AAA:=CONST(HHV(H,60));
STICKLINE(CURRBARSCOUNT=46 ,RCC*1.1,RCC*1.04,100,0),COLOR333555;
{大盘趋势定仓位 }
RSVD:=(INDEXC-LLV(INDEXL,9))/(HHV(INDEXH,9)-LLV(INDEXL,9))*100;
KD:=SMA(RSVD,3,1);
ZJD:=(INDEXO+INDEXH+INDEXL+INDEXC)/4;
YZD:=IF(BARSCOUNT(INDEXC)>60,VOL/SUM(INDEXV,60),VOL/SUM(INDEXV,BARSCOUNT(INDEXC)));
CYC50D:=DMA(ZJD,YZD/0.50);
CYC0D:=DMA(ZJD,YZD);
KPXSD:=(CYC50D/CYC0D-1)*100;
KPD:=IF(KPXSD<0,85,IF(KPXSD>=0 AND KPXSD<5,60,IF(KPXSD>=5 AND KPXSD<15,35,IF(KPXSD>=15,15,90))));
大盘风险:=(KD+KPD)/2,NODRAW;
大盘M3:=MA(REF(INDEXC,1),3);
总涨家:="SZ399001$ADVANCE"+"SH999999$ADVANCE",COLORRED,NODRAW;
总跌家:="SZ399001$DECLINE"+"SH999999$DECLINE",COLORGREEN,NODRAW;
总涨家5日:=SUM(("SZ399001$ADVANCE"+"SH999999$ADVANCE"),5);
总跌家5日:=SUM(("SZ399001$DECLINE"+"SH999999$DECLINE"),5);
总五日比:=(总涨家5日/总跌家5日);
ZWB:=总五日比>REF(总五日比,1)OR 大盘M3>REF(大盘M3,1);
大盘持股: ZWB,NODRAW,COLORRED;
总仓位%:(100-大盘风险),NODRAW;
{个股仓位 }
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
ZJ:=(O+H+L+C)/4;
YZ:=IF(BARSCOUNT(C)>60,VOL/SUM(VOL,60),VOL/SUM(VOL,BARSCOUNT(C)));
CYC50:=DMA(ZJ,YZ/0.50);
CYC0:=DMA(ZJ,YZ);
KPXS:=(CYC50/CYC0-1)*100;
KP:=IF(KPXS<0,85,IF(KPXS>=0 AND KPXS<5,60,IF(KPXS>=5 AND KPXS<15,35,IF(KPXS>=15,15,90))));
个风险:(K+KP)/2,NODRAW;
SHORT:=ATAN((EMA(C,7)/REF(EMA(C,7),1)-1)*100)*57.3;
LONG:=ATAN((EMA(C,21)/REF(EMA(C,21),1)-1)*100)*57.3;
个持股:SHORT>LONG,NODRAW,COLORYELLOW;
个仓位%:100-个风险,COLORRED,NODRAW;
{BOLL+K线 }
BBI:=(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;
DWN:BBI-P*STD(BBI,N),COLORYELLOW,LINETHICK1;
UPR:BBI+P*STD(BBI,N),COLORFF50FF,LINETHICK1;
MA5:MA(C,5),COLORWHITE,LINETHICK1;
IF(MA5>REF(MA5,1),MA5,DRAWNULL),COLORRED,LINETHICK1;
M10:MA(C,10),COLORA08888;
M89:=MA(INDEXC,89),COLORMAGENTA;
{乖离均线 }
AA05:=MA(C,5),COLOR0099CC;
五乖:=(C-AA05)/AA05*100;
BB05:=ATAN((AA05/REF(AA05,1)-1)*100)*180/3.1416;
速度5:=SMA(EMA((AA05-REF(AA05,1))/REF(AA05,1),3)*100,3,1);
加速度5:=EMA((速度5-REF(速度5,1)),3),LINETHICK0;
AA10:=MA(C,10);AA20:=MA(C,20);
BB10:=ATAN((AA10/REF(AA10,1)-1)*100)*180/3.1416;
AA30:=MA(C,30),LINETHICK2;
三拾乖:=(C-AA30)/AA30*100,LINETHICK0;
VAR1G:=(AA20-AA30)>REF((AA20-AA30),1) AND AA20>REF(AA20,1) AND AA30>REF(AA30,1);
VAR2G:=(AA30-AA20)<REF((AA30-AA20),1) AND AA20<REF(AA20,1) AND AA30<REF(AA30,1);
BB30:=ATAN((AA30/REF(AA30,1)-1)*100)*180/3.1416;
清仓:=FILTER(COUNT(CROSS(30,BB05),5)>=1 AND (C>AA30 OR O>AA30) AND AA05<REF(AA05,1) AND 三拾乖<REF(三拾乖,1) AND AA10<REF(AA10,1),10);
JCG:=CROSS(0,五乖) AND 三拾乖<REF(三拾乖,1) AND AA10>REF(AA10,1) ;
减仓:=FILTER(JCG,10);
MR:=COUNT(CROSS(五乖,0),3)>=1 AND 三拾乖>REF(三拾乖,1) AND AA05>REF(AA05,1) AND (C/REF(C,1)-1)*100>5 AND REF(C,1)<AA30;
买入:=FILTER(MR,10);
DRAWICON(减仓,H*1.01,12);
日均价:=AMOUNT/VOL/100;
JF1:=SMA(SMA(EMA(日均价,5)*2-MA(日均价,5),3,1),3,1),COLOR999900;
补偿:=FLOOR(((JF1-MA(JF1,5))/MA(JF1,5)*100));
趋势:=SMA(SMA((EMA(日均价,(5+ABS(补偿)))),2,1),2,1),COLOR666666;
多方趋势:=7*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1)-3*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1),3,1)-SMA(SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*30,4,1),3,1),2,1);
天线:=78.89;
顶:=CROSS(天线,多方趋势) AND C>趋势;
DRAWICON(顶,H*1.02,2);
VAR1B:=CLOSE>REF(CLOSE,1) AND CLOSE>REF(CLOSE,2);
VAR2B:=REF(VAR1B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR3B:=REF(VAR2B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR4B:=REF(VAR3B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR5B:=REF(VAR4B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR6B:=REF(VAR5B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR7B:=REF(VAR6B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR8B:=REF(VAR7B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR9B:=REF(VAR8B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARAB:=REF(VAR9B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VARBB:=REF(VARAB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARCB:=REF(VARBB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VARDB:=CLOSE<REF(CLOSE,1) AND CLOSE<REF(CLOSE,2);
VAREB:=REF(VARDB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VARFB:=REF(VAREB,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR10B:=REF(VARFB,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR11B:=REF(VAR10B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR12B:=REF(VAR11B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR13B:=REF(VAR12B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR14B:=REF(VAR13B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR15B:=REF(VAR14B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR16B:=REF(VAR15B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR17B:=REF(VAR16B,1) AND CLOSE<=REF(CLOSE,1) AND CLOSE>=REF(CLOSE,2);
VAR18B:=REF(VAR17B,1) AND CLOSE>=REF(CLOSE,1) AND CLOSE<=REF(CLOSE,2);
VAR19B:=REF(VARDB OR VAREB OR VARFB OR VAR10B OR VAR11B OR VAR12B OR VAR13B OR
VAR14B OR VAR15B OR VAR16B OR VAR17B OR VAR18B,1) AND VAR1B;
VAR1AB:=REF(VAR1B OR VAR2B OR VAR3B OR VAR4B OR VAR5B OR VAR6B OR VAR7B OR
VAR8B OR VAR9B OR VARAB OR VARBB OR VARCB,1) AND VARDB;
DRAWTEXT(VAR1AB,H*1.03,'↓'),COLORGREEN;
{波段极品}
JD:=MA(CLOSE,20)+2*STD(CLOSE,20);
YD:=MA(CLOSE,20)-2*STD(CLOSE,20);
DRAWICON(CROSS(YD,(REF(HIGH,1)+REF(LOW,1))/2),L/1.035,1);
{精准操盘 }
AAJ:=EMA(C,5)-EMA(C,13);
BBJ:=EMA(AAJ,3);
X:=AAJ>REF(AAJ,1);
Y:=REF(AAJ,3)>=REF(AAJ,2);
ZZ:=REF(AAJ,2)>=REF(AAJ,1);
ZZ1:=AAJ<BBJ;
注意:=X AND Y AND ZZ AND ZZ1 ;
DRAWTEXT(注意,L*0.99,'→?'),COLORYELLOW;{'→?'表示趋势转换};
{大盘逃顶抄底 }
Z:=MA(C,120);
VAR3:=(MA(H,5)-Z)/Z;
VAR4:=MA((CLOSE-LLV(LOW,10))/(HHV(HIGH,10)-LLV(LOW,10))*100,3);
VAR5:=MA((CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100,3);
D1:DRAWTEXT(CROSS(95,VAR4) AND VAR3>0.3 AND C>200,H*1.04 ,'★S'),COLORCYAN;
D2:DRAWTEXT( CROSS(93,VAR4) AND HHV(H,30)/LLV(L,30)>1.1 AND REF(Z,1)/Z>0.997 AND C>200,H*1.04 ,'★S'),COLORGREEN;
D3:DRAWTEXT(CLOSE<Z AND Z<REF(Z,1) AND REF(VAR4,1)>90 AND VAR4<REF(VAR4,1) AND REF(VAR4,1)>REF(VAR4,2) AND C>200 ,H*1.04,'★S'),COLORBLUE;
D4:DRAWTEXT(CLOSE>Z AND REF(VAR5,1)<30 AND VAR5>REF(VAR5,1) AND REF(VAR5,1)<REF(VAR5,2)AND C>200 ,L*0.97 ,'★B |