By Saumya Vaishampayan 

U.S. stocks rose Wednesday, with the Nasdaq Composite Index inching closer to breaking its 15-year-old record high.

The Nasdaq Composite gained 21.07 points, or 0.4%, to 5035.17. With Wednesday's gains, the tech-heavy index is just 0.3% below its record of 5048.62 hit in March 2000.

The Dow Jones Industrial Average rose 88.68 points, or 0.5%, to 18038.27 and the S&P 500 advanced 10.67 points, or 0.5%, to 2107.96.

Stocks opened higher Wednesday and then quickly turned lower, pushing the Dow down 62 points at its low of the session. Stocks pared losses by midmorning and pushed to session highs in afternoon trading.

Traders said there wasn't one piece of news driving stocks higher Wednesday, pointing to gains in technology stocks ahead of key earnings reports, a selloff in government bonds and stronger-than-expected housing data.

Technology stocks in the S&P 500 rose 1.1%, posting the biggest sector gain.

Recent action in the major indexes has been choppy, leaving them trading in a range below all-time highs. The Dow is 1.4% away from its record of 18288.63 and the S&P is 0.4% below its closing high of 2117.39.

"We've really been in a trading range since earnings started," said Tom Wright, director of equities at JMP Securities. "For me, one of the key factors is that on selloffs, we definitely see new money coming to the market. We are encouraged by that," he added.

Companies attracting attention Wednesday included McDonald's Corp. The burger giant reported a steeper-than-expected 32% decline in profit, in part because of changes in foreign-exchange rates. Revenue fell 11% to $5.96 billion, in line with Wall Street expectations. Shares rose 3.1%, adding 20 points to the Dow's overall gain.

Coca-Cola Co. reported better-than-expected profit and revenue in its first quarter. Shares added 1.3%.

Boeing Co. reported a jump in earnings in its latest quarter, but a sharp drop in cash flow for the period disappointed investors. Shares fell 1.4%.

Including results from 120 companies in the S&P 500, earnings are on track to fall 3.8% from a year earlier, according to FactSet. About 76% of those companies have beaten profit expectations that were slashed heading into the reporting season. The picture is less rosy for revenues, with just 45% of companies beating top-line expectations.

"I really don't feel like we're getting the growth in revenues that makes me enthusiastic about earnings going forward," said Carlton Neel, who manages about $1.4 billion as a senior managing director and portfolio manager at Euclid Advisors LLC.

Many portfolio managers say that while valuations are elevated, they aren't yet worrisome. The S&P 500 trades at 17.4 times the previous 12 months' earnings, according to FactSet. That is above the 10-year average of 14.6.

"The market is not cheap...but the reality is there's nowhere else to go, " said Tom Digenan, who manages $6.5 billion as head of U.S. equities at UBS Global Asset Management. Mr. Digenan said he has become more aggressive in looking for opportunities in the energy sector. "We're trying to play the names that are a little bit more sensitive to the price of oil," he said. Mr. Digenan said that earlier this year, he bought stocks of oil-services companies, which could benefit from a stabilization in oil prices.

The yield on the 10-year Treasury note rose to 1.972% from 1.913% on Tuesday. Yields rise as prices fall.

In commodity markets, gold futures fell 1.3% to $1186.90 an ounce. Crude-oil futures slipped 0.8% to $56.16 a barrel.

Overseas stock action was mixed. France's CAC 40 rose 0.4%, while Germany's DAX lost 0.6%. Japanese stocks gained, pushing the Nikkei Stock Average to close above 20000 for the first time since 2000.

In economic news, U.S. existing-home sales rose 6.1% in March from February to an annual rate of 5.19 million, reaching the highest level in 18 months. Economists surveyed by The Wall Street Journal had expected March sales to rise to a rate of 5.03 million.

Write to Saumya Vaishampayan at saumya.vaishampayan@wsj.com

Access Investor Kit for The Boeing Co.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US0970231058

Access Investor Kit for The Dow Chemical Co.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US2605431038

Access Investor Kit for The NASDAQ OMX Group, Inc.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US6311031081

Boeing (NYSE:BA)
Historical Stock Chart
From Aug 2024 to Sep 2024 Click Here for more Boeing Charts.
Boeing (NYSE:BA)
Historical Stock Chart
From Sep 2023 to Sep 2024 Click Here for more Boeing Charts.