ADIFF:=EMA(CLOSE,8)-EMA(CLOSE,13);
ADEA:=EMA(ADIFF,9);
AMACD:=2*(ADIFF-ADEA);
JA1:=BARSLAST(CROSS(MA(C,5),MA(C,10)))+1;
JA2:=(C-REF(C,JA1))/REF(C,JA1)*100>20;
JA3:=(HHV(C,5)-LLV(C,5))/C<0.03;
相对顶:=JA2 AND JA3 AND CROSS(ADEA,ADIFF);{“股价横盘、MACD死叉卖出”}
JB1:=HIGH>=HHV(HIGH,20);
JB2:=JB1 AND (ADIFF<REF(ADIFF,1) OR AMACD<REF(AMACD,1));
绝对顶:=FILTER(JB2,5);{“价格、MACD背离卖出”}
DRAWICON(相对顶 OR 绝对顶,H*1.02,2);