After setting a record high in mid-July, the S&P 500 has been struggling to gain traction