MA4:=ma(close,4);
ma10:=ma(close,10);
ma20:=ma(close,20);
ma62:=ma(close,62);
sma4:= ref(SLOPE(ma4,2),1)<0 and SLOPE(ma4,2)<=0 and ref(SLOPE(ma4,2),1)<SLOPE(ma4,2);
sma10:= ref(SLOPE(ma10,2),1)<0 and SLOPE(ma10,2)<=0 and ref(SLOPE(ma10,2),1)<SLOPE(ma10,2);
sma20:= ref(SLOPE(ma20,2),1)<0 and SLOPE(ma20,2)<=0 and ref(SLOPE(ma20,2),1)<SLOPE(ma20,2);
sma62:=(SLOPE(ma62,3)>0) or (ref(SLOPE(ma62,3),1)<0 and SLOPE(ma62,3)<=0 and ref(SLOPE(ma62,3),1)<SLOPE(ma62,3));
anyup:=(slope(ma10,3)>0 or slope(ma20,3)>0 or slope(ma62,3)>0);
conn:anyup and sma62 and (sma10 or SLOPE(ma10,2)>0) and (sma20 or SLOPE(ma20,2)>0) and sma4;