编写要求:
1.跌40%(120天高点)+MACD背离+5日均量放大3倍=盘区起点 2.盘区振幅<30%+20个周期内60日均线连续5日走平 3.价格进入盘区上95%信号1,突破盘区高点信号2
公式在线网解答:
{信号1}
A1:=MA(C,5)<REF(MA(C,5),1) AND MA(C,5)<MA(C,10) AND
MA(C,10)<MA(C,20) AND MA(C,20)<MA(C,60);
A2:=C/HHV(H,120)<=0.6 AND A1;{均线空头120天高点跌40%以上};
B1:=BARSLAST(CROSS("MACD.DIF","MACD.DEA") AND "MACD.DEA"<EMA("MACD.DEA",60));
B2:=REF(LLV("MACD.DIF",5),B1);
B3:=REF(LLV(C,5),B1);
B4:=B3/REF(B3,1)<=0.75 AND B2>REF(B2,1);{MACD背离};
C1:=BARSLAST(EXIST(A2,3) AND B4);{盘区起点};
C2:=REF(MA(V,5),C1)/REF(LLV(MA(V,5),5),C1)>=3;{均量5放大3倍进入盘区};
C3:=HHV(C,C1+1)/LLV(C,C1+1)<1.3;{盘区振幅小于30%};
C4:=SLOPE(MA(C,60),20)/MA(MA(C,60),20)*100;
C5:=C4<0.3 AND C4>-0.1;{60均线开始走平};
信号1:CROSS(C/HHV(C,C1+1),0.95) AND C>O AND MA(V,5)>REF(MA(V,5),1) AND C3 AND C5;
{信号2}
A1:=MA(C,5)<REF(MA(C,5),1) AND MA(C,5)<MA(C,10) AND
MA(C,10)<MA(C,20) AND MA(C,20)<MA(C,60);
A2:=C/HHV(H,120)<=0.6 AND A1;{均线空头120天高点跌40%以上};
B1:=BARSLAST(CROSS("MACD.DIF","MACD.DEA") AND "MACD.DEA"<EMA("MACD.DEA",60));
B2:=REF(LLV("MACD.DIF",5),B1);
B3:=REF(LLV(C,5),B1);
B4:=B3/REF(B3,1)<=0.75 AND B2>REF(B2,1);{MACD背离};
C1:=BARSLAST(EXIST(A2,3) AND B4);{盘区起点};
C2:=REF(MA(V,5),C1)/REF(LLV(MA(V,5),5),C1)>=3;{均量5放大3倍进入盘区};
C3:=HHV(C,C1+1)/LLV(C,C1+1)<1.3;{盘区振幅小于30%};
C4:=SLOPE(MA(C,60),20)/MA(MA(C,60),20)*100;
C5:=C4<0.3 AND C4>-0.1;{60均线开始走平};
信号2:CROSS(C,REF(HHV(C,C1+1),1)) AND C>O AND MA(V,5)>REF(MA(V,5),1) AND
MA(V,5)>MA(V,10) AND EXIST(C3 AND C5,2);