US stocks trimmed earlier gains to finish moderately higher on Wednesday, partially bouncing back after a four-day losing streak, as investors awaited some crucial quarterly figures from Nvidia.