DIF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIF,9); MACD:=(DIF-DEA)*2;
{風(fēng)洞}
X1:=EXIST(CROSS(DEA,DIF),5) AND CROSS(DIF,DEA);{死叉離金叉日越小越強(qiáng)}
{穿零}
X2:=CROSS(DIF,0) OR CROSS(DEA,0);
{DIF角度}
角度:=ATAN((DIF/REF(DIF,1)-1)*100)*57.3; X3:=角度>45 AND DIF>REF(DIF,1);
{暴漲研究,需進(jìn)一步完善}
周DIF:="MACD.DIF#WEEK"; 周DEA:="MACD.DEA#WEEK"; 月DIF:="MACD.DIF#MONTH"; 月DEA:="MACD.DEA#MONTH";
XX1:=月DEA>0 AND 周DIF>周DEA AND 周DEA>月DEA AND CROSS(月DIF,月DEA); XX2:=月DEA>-0.5 AND 周DEA>-0.5 AND 月DIF>月DEA AND 周DEA>月DEA AND CROSS(周DIF,周DEA); X4:=XX1 OR XX2;
{空中纜繩} DEAA:=EMA(DIF,27); MACDA:=(DIF-DEAA)*2; B:=MIN(DIF,DEAA)/MAX(DIF,DEAA)>0.95; X5:=MA(CLOSE,30)>REF(MA(CLOSE,30),1) AND DIF>0 AND DEAA>0 AND MACDA>REF(MACDA,1) AND B;
{漫步青云} DJE:=DIF>=0 AND DEAA>=0 AND CROSS(DIF,DEAA); A5:=MA(CLOSE,5)>MA(CLOSE,10); V5:=VOL>MA(VOL,5) AND MA(VOL,5)>MA(VOL,10); X6:=DJE AND A5 AND V5 AND MA(CLOSE,30)>=REF(MA(CLOSE,30),1);
{雙佛手} X7:=CLOSE>OPEN AND MA(CLOSE,5)>MA(CLOSE,10) AND MA(CLOSE,10)>MA(CLOSE,30) AND DIF>DEAA AND MACDA>REF(MACDA,1) AND DIF>0 AND DEAA>0 AND MA(VOL,5)>MA(VOL,34) AND MA(CLOSE,30)>=REF(MA(CLOSE,30),1);
{天天} DIFB:=EMA(CLOSE,6)-EMA(CLOSE,13); DEAB:=EMA(DIF,6); MACDB:=(DIF-DEA)*2; X8:=EXIST(CROSS(REF(DEAB,1),REF(DIFB,1)) AND CROSS(DIFB,DEAB),2);
{綠柱底背離} DAYS:=IF(DIF>DEA,BARSLAST(DIF<DEA),BARSLAST(DIF>DEA)); AREA0:=SUM(MACD,DAYS); AREAM1:=REF(AREA0,DAYS); AREAM2:=REF(AREAM1,DAYS); AREAM3:=REF(AREAM2,DAYS); HPRE:=HHV(L,DAYS); HPREM1:=REF(HPRE,DAYS); HPREM2:=REF(HPREM1,DAYS); HPREM3:=REF(HPREM2,DAYS); LPRE:=LLV(L,DAYS); LPREM1:=REF(LPRE,DAYS); X9:=AREAM1>AREAM3 AND HPREM1<HPREM3 AND REF(MACD,1)<0 AND MACD>0 ;
{連續(xù)死叉背離}
D1:=BARSLAST(CROSS(DEA,DIF));{本次死叉到今天的天數(shù)} D2:=REF(BARSLAST(CROSS(DEA,DIF)),D1+1);{兩次死叉之間的天數(shù)} D3:=REF(BARSLAST(CROSS(DEA,DIF)),D1+D2+2);{上兩次死叉之間的的天數(shù)} X10:=LLV(DIF,D1+1)>LLV(DIF,D2+D1+2) {條件1:最后一次死叉之后的DIFF最小值大于倒數(shù)第二次之后的DIFF最小值} &&LLV(C,D1+1)=LLV(C,D2+D1+2) {條件2:最后一次死叉之后的最低收盤(pán)價(jià)就是倒數(shù)第二次之后的最低收盤(pán)價(jià)} &&LLV(DIF,D2+D1+2)>LLV(DIF,D3+D2+D1+3) {條件3:倒數(shù)第二次死叉之后的DIFF最小值大于倒數(shù)第三次之后的DIFF最小值} &&REF(LLV(C,D2+1),D1+1) &&CROSS(DIF,DEA); {條件5:今天MACD金叉};
{一般底背} QZQ:=BARSLAST(REF(MACD,1)<0 AND MACD>0); QM:=LLVBARS(MACD,QZQ+20); MQDZ:=IF(QM>QZQ,REF(MACD,QM),0); XG1:=MACD<0 AND MACD>MQDZ AND CLOSE=LLV(CLOSE,QZQ+20) AND MQDZ<0; X11:=REF(XG1,1)=1 AND MACD>REF(MACD,1);
{雙底背,綠柱與DIF兩者都背離}
QZQ1:=BARSLAST(REF(MACD,1)<0 AND MACD>0); QM1:=LLVBARS(MACD,QZQ1+20); MQDZ1:=IF(QM1>QZQ1,REF(MACD,QM1),0); QF:=LLVBARS(DIF,QZQ1+20); DQDZ:=IF(QF>QZQ,REF(DIF,QF),0); XG1A:=MACD<0 AND MACD>MQDZ1 AND DIF<0 AND DIF>DQDZ AND CLOSE=LLV(CLOSE,QZQ1+20) AND MQDZ1<0 AND DQDZ<0; X12:=REF(XG1A,1)=1 AND MACD>REF(MACD,1);
{最簡(jiǎn)背離,DIF}
AX1:=BARSLAST(L=LLV(L,40)); X13:REF(DIF,AX1)>REF(DIF,AX1+1);
? ?集二: ?DIF:=EMA(CLOSE,12) - EMA(CLOSE,26); DEA:=EMA(DIF,9); MACD:=2*(DIF-DEA);
{0軸上方第一次金叉} X1:=CROSS(DIF,DEA) AND DEA>-1.0 AND DEA<0.5 AND CLOSE>REF(CLOSE,1) AND CLOSE>=MA(C,60); {或X1:DIF>0 AND DEA>0 AND CROSS(DIF,DEA);}
{0軸上方二次金叉,選股設(shè)X2=10即可} X2:=SUM(IF(MACD>0 AND CROSS(DIF,DEA),1,0),0)-HHV(IF(IF(CROSS(DEA,0),1,0), SUM(IF(MACD>0 AND CROSS(DIF,DEA),1,0),0),0),0)=2 AND SUM(IF(MACD>0 AND CROSS(DIF,DEA),1,0), 0)>REF(SUM(IF(MACD>0 AND CROSS(DIF,DEA),1,0),0),1)=10;
{0軸下方一次金叉} X3:=CROSS(DIF,DEA) AND DIF<-0.1;
{0軸下方二次金叉且第二次金叉高于第一次金叉} AA:=BARSLAST(REF(CROSS(DIF,DEA),1)); X4:=CROSS(DIF,DEA) AND DIF>REF(DIF,AA+1) AND AA<20 AND DIF<0;
{0軸下方二次金叉} A:=IF(CROSS(0,DEA),1,0); A1:=IF(DIF<0 AND CROSS(DIF,DEA),1,0); SS:=IF(A,SUM(A1,0),0); SSB:=HHV(SS,0); SSS:=SUM(A1,0); X5:=SSS-SSB=2 AND SSS>REF(SSS,1)=10;
{MACD底位反轉(zhuǎn)點(diǎn)}
DIFA:=EMA(CLOSE,12)-EMA(CLOSE,135); DEAA:=EMA(DIFA,9); MACDA:=(DIFA-DEAA)*2;
X6:MACDA<0 AND MACDA>REF(MACDA ,1) AND REF(MACDA ,1)<REF(MACDA ,2) AND REF(MACDA ,2)<REF(MACDA ,3) AND REF(MACDA ,3)<REF(MACDA ,4);
|