VAR1:=MA(CLOSE,5);
VAR2:=MA(CLOSE,10);
VAR3:=MA(CLOSE,30);
VAR4:=MA(CLOSE,60);
VAR5:=MA(CLOSE,120);
VAR6:=0;
VAR7:=MAX(MAX(MAX(VAR1,VAR2),MAX(VAR3,VAR4)),VAR5);
VAR8:=MIN(MIN(MIN(VAR1,VAR2),MIN(VAR3,VAR4)),VAR5);
XG:BARSLAST(O<=VAR8 AND C>=VAR7 )=VAR6;