n:=13;m:=3;psy:=count(close>ref(close,1),n)/n*100;pa:=ma(psy,m);jj:=dyna**(11) ;tj4:=filter((c-jj)/jj<-0.02 and pa<16,13);tj5:=filter((c-jj)/jj<-0.04 and pa<16,13);tj4 or tj5;
am1:=ma(c,5);am2:=ma(c,10);x:=if(am1>am2,barslast(cross(am1,am2))+1,-1);t1:=count(c>am2,x)=x;xg:t1=0 and ref(t1,1)=1 and am1>am2 and(am1-am2)/ref(hhv(am1-am2,x),1)>0.5;