SHORT:=12;
LONG:=26;
M:=9;
DIFF:=EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA := EMA(DIFF,M);
MACD := 2*(DIFF-DEA);
MACD金叉:=CROSS(DIFF,DEA);
金叉天数:=BARSLAST(MACD金叉);
MCAD持续走红:=LLV(MACD,金叉天数)>=0.0;
MCAD最大红柱:=HHV(MACD,金叉天数);
最大红柱天数:=BARSLAST(MCAD最大红柱);
MCAD二波:=REF(MACD,1)<=REF(MACD,2) AND MACD>=REF(MACD,1);
MA60:=MA(C,60);
均线多头:=C>=MA(C,5) AND C>MA(C,30) AND C>MA60 AND MA60>REF(MA60,1);
ENTERLONG:MCAD持续走红 AND MCAD二波 AND C>=MA(C,5);
EXITLONG:CROSS(0,MACD);