QDIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
QDEA:=EMA(QDIF,9);
Qmacd:=(QDIF-QDEA)*2;
M5:=MA(C,5);
M10:=MA(C,10);
M20:=MA(C,20);
DXW1:=IF((zig(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2))
AND (REF(ZIG(3,5),2)<=REF(ZIG(3,5),3)),1,0);
{- }
XH1:=IF(COUNT(DXW1,3)>0,1,0);
RQ1:=BArslAST(DXW1);
RQ2:=REF(RQ1,RQ1+1)+RQ1+1;
RQ3:=IF(RQ2-RQ1>6,1,0);
ZBW:=IF(DXW1=1,QMacD<0 AND OPEN<M20 AND M5<REF(M5,1),0);
WWMR:=SUM(ZBW,20);
XG:IF(WWMR=2 AND RQ3 AND XH1,1,0);