Stocks advanced on Tuesday as solid earnings and a flurry of merger action laid the foundation for a steady upward trend in the equities market that investors potentially see accelerating.

Stock indexes hit new highs after topping key technical resistance levels. The S&P 500 has rallied more than 6 percent to two-year highs this month and was up around 22.6 percent from closing lows this year.

Analysts said equity markets were also got a boost as fund managers reallocated cash to equities from fixed income and reduced cash positions on expectations of an improving economy.

Your alternative is to make nothing in cash, lose money in treasuries or make another 15 percent in stocks. So what are you going to do? said Phil Orlando, chief equity market strategist, at Federated Investors in New York.

Investors are going through that same calculus right now and saying I'm underallocated to stocks.

The Dow Jones industrial average <.DJI> gained 48.33 points, or 0.42 percent, to 11,526.46. The Standard & Poor's 500 Index <.SPX> rose 6.50 points, or 0.52 percent, to 1,253.58. The Nasdaq Composite Index <.IXIC> advanced 15.56 points, or 0.59 percent, to 2,665.12.

Adobe Systems Inc jumped 4.7 percent to $30.56 a day after an upbeat forecast in contrast with a pessimistic outlook three months ago.

Adding to the positive tone, American International Group Inc gained 2.5 percent to $54.74 after officials briefed on the situation told Reuters the U.S. government plans to sell a large piece of its stake in the company.

U.S. coal miner Massey Energy Co rose 1.2 percent to $52.48 after the Wall Street Journal reported rival Alpha Natural Resources Inc offered to buy it. Alpha climbed 3 percent to $55.23.

Further supporting rising stock indexes were recent technical signals indicating the march upward could continue.

The S&P 500, which has gained in each of the last three weeks, broke through the 61.8 percent Fibonacci retracement of the 2007-2009 bear market slide earlier this month.

Technicians say the next stop is the 76.4 percent retracement at 1,362.

John Brady, senior vice president at MF Global in Chicago, expects the market to move either slowly sideways or higher as S&P 500 works off an overbought condition shown in the seven-day and nine-day Relative Strength Index (RSI).

It's a grind trade higher on not a whole lot of volume, he said. A trade between 1,250 and 1,230 (in the S&P 500) seems really well contained, and any profit-taking will probably be modest.

The RSI provides a measure of higher closes to lower closes over a given trading period and is closely watched by traders.

In other individual movers, Martek Biosciences Corp surged 35.2 percent to $31.59 after Dutch group DSM , the world's largest vitamins maker, agreed to buy the maker of U.S. baby food ingredients.

Jabil Circuit Inc , the electronics manufacturer, advanced 10 percent to $19.38 a day after it reported better-than-expected quarterly profit and forecast a robust second quarter.

(Additional reporting by Edward Krudy; editing by Padraic Cassidy and Jeffrey Benkoe)