The S&P 500 notched its seventh straight month of gains.