The rally in the U.S. equity markets continues to amaze traders, amid remarkable resilience. Stocks such as ViaSat, Inc. (NASDAQ:VSAT), Consolidated Graphics, Inc. (NYSE:CGX), and MEMC Electronic Materials, Inc. (NYSE:WFR) registered more than 20 percent gains last week and touched new 52-week highs. Here is what is driving these stocks:

Viasat

Consolidated Graphics, Inc. (NYSE:CGX) provides commercial printing and print-related services, and the business went through a rough patch during last year. However, the company managed to grow its top line even during last year, albeit at a modest rate. Its efforts in the direction of cutting costs were visible in the financial report presented for the latest quarter. During the period, the company managed to cut its losses to $0.3 million from $5.9 million in the same period last year. As a result, the stock has gone up more than 32 percent during the last month and currently trades at a price earnings multiple of 26.7. After beating street expectations in the latest quarter, prospects of a continued turnaround for the company have improved further which is visible in the forward earnings multiple of 14.9. The company has reasonable debt on its balance sheet and its price by sales ratio of 0.43 and price by book value of 1.61 indicate it is not yet overvalued.

Montana based MEMC Electronic Materials, Inc. (NYSE:WFR) is a firm engaged in production and sales of silicon wafers for the semiconductor industry but also counts production of solar wafers in its business. Its stock has been on a roll recently, gaining over 53 percent in the last month even though its latest report was nowhere near encouraging. What has driven the stock lately is the deal signed between SolarCity Corp (NASDAQ:SCTY) and Goldman Sachs which was a sentiment booster for the entire solar sector. It is somewhat ironical that MEMC Electronic’s semiconductor business is being outperformed by the relatively new solar energy system line of business. For the full year, it expects solar business to grow in the range of 10 percent to 28 percent. Given a debt equity ratio of 4.1 and shrinking margins in solar business, it does not appear to be a good idea to enter the stock at current valuations.

ViaSat Inc (VSAT) Swung to Profit

Shares of ViaSat, Inc. (NASDAQ:VSAT) – which offers satellite and wireless networking technology for private sector and governments – jumped 21 percent last week. This extended the rally seen so far in the month and the stock has advanced 56 percent over the last 30 days. What caused this euphoria in the stock were the company’s financial results for the fourth quarter ended March 29, 2013 which saw ViaSat swinging to a profit after a long time. The company reported a 28 percent increase in revenue to $308.7 million while net profit stood at $2.3 million compared to a loss of $7.3 million in the same duration a year ago. However, these exceptionally good fourth quarter results were not able to salvage the bottom-line for the full year which continued to remain in red. Nevertheless, it was an indication that things are changing for good for the company and the market bought this story. Following the results, the stock saw a re-rating by analysts witha consensus price target of $65. The stock has already gone a tad beyond these targets and its over-reliance on government for business and a forward price earnings ratio of 80 indicate further upside may be limited.

These stocks represent changing fortunes of these companies and while this is a positive development, prices seem to have run ahead of fundamentals in some cases. With markets treading high, substantial potential downside has opened up for investors in case the economy falters or markets tumbles due to any other factor.