Stocks gain as upbeat Wall St earnings lift outlook