FS:=MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
CG:=IF(MA(CLOSE,17)<FS,FS,MA(CLOSE,17));
xg1:CROSS
(MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1),MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1)))
and (cg-(ema(c,3)-cg))<CLOSE and (cg-(ema(c,3)-cg))<REF((cg-(ema(c,3)-cg)),1);