U.S. stocks rose for a second day on Thursday in a choppy session, with technology and consumer discretionary stocks leading the way after upbeat earnings.

Sellers crowded around the S&P 500's 50-day moving average for a third day. The level, now just above 1,328, is gaining strength as technical resistance and could prevent any rebound in the benchmark.

The market's ability to sustain an advance ebbed and flowed with developments in the foreign-exchange market and fears over Europe's sovereign debt crisis.

Currency strength right now is the major mover of equity and commodity markets, said Michael Yoshikami, president and chief investment strategist at YCMNet Advisors in Walnut Creek, California.

No market sector can move away from that, he said.

The broad S&P 500 was treading water throughout the morning after economic data failed to meet expectations, but once again found support once the euro stabilized against the U.S. dollar.

The 20-day correlation between the S&P 500 and the dollar index <.DXY> was at -0.8. It hit -0.95 earlier this month, with a perfect inverse correlation scoring -1.

The Nasdaq outperformed other major indexes after NetApp Inc's stock was buoyed by strong results. The tech-heavy index also got a boost from shares of Microsoft Corp , up 2 percent at $24.67 after a prominent investor said its chief executive should resign. The company's board stood by its CEO.

The Dow Jones industrial average <.DJI> edged up 8.10 points, or 0.07 percent, to 12,402.76. The Standard & Poor's 500 Index <.SPX> gained 5.22 points, or 0.40 percent, to 1,325.69. The Nasdaq Composite Index <.IXIC> rose 21.54 points, or 0.78 percent, to 2,782.92.

TIFFANY TASTES, UNCERTAIN TIMES

The best-performing S&P sector on Thursday was consumer discretionary, helped by Tiffany & Co , up 8.6 percent at $76.04 after the luxury retailer reported its first-quarter results and raised its outlook. Luxury handbag and accessories company Coach Inc rose 5 percent to $63.68.

The S&P's consumer discretionary sector index <.GSPD> rose 0.8 percent after dropping 2.4 percent over the previous four days.

Market participants say the uncertainty about the economy makes it hard to invest medium or long term, leaving stocks vulnerable to short-term volatility.

People are timing themselves and rotating in and out of various sectors, said Yu-Dee Chang, principal and chief trader of ACE Investment Strategists in McLean, Virginia. Everybody realizes that's the game everybody else is playing, so in order to compete or keep up, that's what you've got to do.

In a sign of rising concern about the economic outlook, Goldman Sachs cut its year-end target for the S&P 500 by 3.33 percent, to 1,450 from 1,500. The lower target represents an upside of almost 10 percent from current levels.

The decision by Goldman Sachs to cut its S&P 500 target, one of the highest on the Street, comes after UBS and Citigroup raised their earnings forecast for S&P 500 companies last week, but kept their targets unchanged. That indicates investors are starting to put a greater risk premium on the U.S. stock market.

Applications for unemployment insurance unexpectedly rose in the latest week and stayed at elevated levels, while U.S. gross domestic product rose at an annual rate of 1.8 percent in the first quarter, unchanged from the previous estimate and below analysts' expectations for more robust growth.

The S&P 500 has fallen almost 3 percent this month due to a string of weaker-than-expected economic indicators.

Helping the Nasdaq, NetApp Inc posted better-than-expected results as more cloud computing drove demand for its data storage products. Its shares rose 6.9 percent to $55.31.

Hedge fund manager David Einhorn called for Steve Ballmer, the chief executive of Microsoft Corp , to step down. Microsoft's board stood behind Ballmer. Shares of the Nasdaq and Dow component rose 2 percent to $24.67.

About 6.4 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below the daily average so far this year of 7.64 billion.

Advancing stocks outnumbered declining ones on the NYSE and Nasdaq by a ratio of more than 2 to 1.

(Reporting by Rodrigo Campos; Additional reporting by Edward Krudy; Editing by Jan Paschal)