The S&P 500 index, Nasdaq composite, and Dow Jones industrial average all rose in US trading on Tuesday.