The S&P 500 had a volatile week, marked by sharp daily swings that saw the index fall below its 50-day moving average for the first time since April.