SHORT:=8;
LONG:=13;
MID:=5;
DIF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:=EMA(DIF,MID);
macd:=(DIF-DEA)*2;
MACDLINE:=IF(crOSS(DIF,DEA),1+1,IF(CROSS(DEA,DIF),1-0.5,1+0));
A1:=DIF>DEA;
N:=9;
M1:=3;
M2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);
J:=3*K-2*D;
kdjLINE:=IF(CROSS(K,D) AND CROSS(J,K),1,IF(CROSS(D,K) AND CROSS(K,J),0-0.5,0));
A2:=K>D;
N1:=6; N2:=12; N3:=24;
LC:=REF(CLOSE,1);
rsi1:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(Abs(CLOSE-LC),N1,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*100;
RSI3:=SMA(MAX(CLOSE-LC,0),N3,1)/SMA(ABS(CLOSE-LC),N3,1)*100;
A3:=RSI1>RSI2;
WN:=9; WM1:=3; WM2:=3;
wrSV:=-(HHV(HIGH,WN)-CLOSE)/(HHV(HIGH,WN)-LLV(LOW,WN))*100; {威廉指标采用反向,所以加“负号”};
LWR1:=SMA(WRSV,WM1,1);
LWR2:=SMA(LWR1,WM2,1);
A4:=LWR1>LWR2;
BM1:=3; BM2:=6; BM3:=12; BM4:=24;
bbi:=(MA(CLOSE,BM1)+MA(CLOSE,BM2)+MA(CLOSE,BM3)+MA(CLOSE,BM4))/4;
A5:=CLOSE>BBI;
{MN:=12; MM:=6;
mtm:CLOSE-REF(CLOSE,MN);
MTMMA:=MA(MTM,M)};
MTM:=CLOSE-REF(CLOSE,1);
mms:=100*EMA(EMA(MTM,5),3)/EMA(EMA(ABS(MTM),5),3);
MMM:=100*EMA(EMA(MTM,13),8)/EMA(EMA(ABS(MTM),13),8);
A6:=MMS>MMM;
红数:=A1+A2+A3+A4+A5+A6, COLORYELLOW;
买入:(红数=6 AND REF(红数,1)<>6)*3, COLORYELLOW;