VAR1:=MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(MAX(EMA(C,30),EMA(C,35)),EMA(C,40)),EMA(C,45)),EMA(C,90)),EMA(C,98)),EMA(C,106)),EMA(C,114)),EMA(C,140)),EMA(C,148)),EMA(C,156)),EMA(C,164));
VAR2:=MIN(MIN(MIN(MIN(MIN(MIN(MIN(MIN(MIN(MIN(MIN(EMA(C,30),EMA(C,35)),EMA(C,40)),EMA(C,45)),EMA(C,90)),EMA(C,98)),EMA(C,106)),EMA(C,114)),EMA(C,140)),EMA(C,148)),EMA(C,156)),EMA(C,164));
VAR3:=(EMA((H+L+3*C)/5,20)+EMA((H+L+3*C)/5,30)+EMA((H+L+3*C)/5,40)+EMA((H+L+3*C)/5,50))/4;
VAR4:=IF(INBLOCK(1),0.2,IF(INBLOCK(2),0.2,IF(INBLOCK(3),0.05,0.1)));
VAR5:=EMA(C,114)>EMA(C,148) AND C>VAR1;
VAR6:=((H+L+C)/3-MA((H+L+C)/3,89))/(0.015*AVEDEV((H+L+C)/3,89));
VAR7:=BARSLAST(CROSS(MA(C,5),MA(C,10)));
VAR8:=(C-LLV(L,30))/(HHV(H,30)-LLV(L,30))*100;
VAR9:=BARSLAST(CROSS(20,SMA(SMA(VAR8,3,1),3,1)));
VAR10:=VAR4>0.06 AND VAR5 AND C/REF(C,1)>1.02 AND VAR1/VAR2< 1.2;
VAR16:=VAR10 AND VAR7< 5 AND SMA(SMA(VAR8,3,1),3,1)< 60 AND VAR9< 20;
VAR18:=VAR10 AND VAR1/VAR2< 1.15 AND C/REF(C,1)>1.05 AND SMA(SMA(VAR8,3,1),3,1)< 70 AND VAR6>=HHV(VAR6,5);
XG:VAR16 OR VAR18;