A:=(HHV(H,50)+LLV(L,50))/2;
B:=If(L>a,1,If(H<a,-1,0));
Buy:=B=1 and Ref(B,-1)<>1;
Sell:=B=-1 and Ref(B,-1)<>-1;
Buy-Sell;