calculate stock trend