Stocks showed a lack of direction throughout much of the trading day on Tuesday before ending the session slightly higher. The slim gains on the day lifted the Nasdaq to a new record closing high, while the S&P 500 reached its best closing level in a month.