DIFIF1:=(EMA(CLOSE,12) - EMA(CLOSE,26))*100/EMA(CLOSE,26);
DEAEA1:=EMA(DIFIF1,9);
macd1:=2*(DIFIF1-DEAEA1);
T:=BArslAST(crOSS(DIFIF1,DEAEA1) AND DIFIF1<0);
T1:=SUMBARS(T=0,2);
T2:=SUMBARS(T=0,3);
M:=BARSLAST(CROSS(0,MacD1));
M1:=SUMBARS(M=0,2);
M2:=SUMBARS(M=0,3);
DA1:=REF(DIFIF1,BARSLAST(DIFIF1=LLV(DIFIF1,M+1)));
DA2:=REF(DA1,T1-1);
DA3:=REF(DA2,T1-1);
LT:=BARSLAST(L=LLV(L,M+1));
MT:=BARSLAST(DIFIF1=LLV(DIFIF1,M+1));
L1:=REF(L,LT);
L2:=REF(L1,T1-1);
L3:=REF(L2,T1-1);
XG:T=0 AND L1<L2 AND L2<L3 AND DA1>DA2 AND DA2>DA3;