A Stock trading Algorithm