The last few months have been ugly for most stock investors. Unfortunately, many seem to be making exactly the same mistakes they made early last year. But if you take a smarter approach toward the year's top trends, you'll do a much better job of avoiding what could be catastrophic consequences for your finances.

Buying high, selling low
The Wall Street Journal recently reported that the average U.S. stock mutual fund lost more than 10% during the second quarter alone, leaving them with about a 5% loss for the year thus far. International stocks did even worse, losing an average of 13% for the quarter and 12% so far this year as they had to deal not only with troublesome stock markets in Europe but also the negative impact of a stronger dollar on their foreign-denominated holdings.

As typically happens when markets behave badly, investors started pulling money out of stock mutual funds in full force as their prices fell. Fund shareholders sold a net $21.8 billion from U.S. stock funds from April to June. And even though foreign stock funds took in more money than went out, the amount was a relatively small $3.8 billion for the quarter.

Meanwhile, bond funds continued to attract assets, gathering $62.1 billion in net inflows for the quarter. With a gain of almost 3%, bond fund returns looked reasonably solid given the uncertainty in stocks.

The smart sectors
Even in a down market, however, there were winners and losers. The best performing sector of the stock mutual fund universe was real estate, which have seen gains of nearly 11% so far this year. Even though the housing market is still facing a lot of difficulties, rental prices have been on the upswing in some areas lately, which has pushed apartment REITs Equity Residential (NYSE: EQR) and AvalonBay (NYSE: AVB) up sharply in the first half of the year. Moreover, the combination of a strong dollar and at least some upbeat economic news has apparently pushed tourists back on the road, as both Starwood Hotels (NYSE: HOT) and Host Hotels (NYSE: HST) have posted gains of 25% or more since the beginning of the year.

Another area that has rebounded sharply in recent months is the airline industry. US Airways (NYSE: LCC) has nearly doubled in price, while UAL (Nasdaq: UAUA) and Continental Airlines (NYSE: CAL) have both seen impressive gains as their prospective merger continues to get scrutiny from regulators. Airlines have been able to boost prices even while fuel costs have remained relatively stable, as initiatives to cut excess capacity have finally started to bear fruit.

On the other side of the spectrum, energy stocks were the big losers, as fallout from the BP oil spill has led to a new moratorium on deepwater drilling activity in the Gulf and concerns about increased regulation coming in the future. Although BP itself appears to have hit bottom in recent days and now is the focus of takeover speculation, other energy players have yet to escape the collateral damage the incident has caused.

What's next?
How you should invest to take advantage of these trends depends on your time horizon. If you're a short-term investor seeking quick profits, then your main question should be whether there's any catalyst out there that will lead to these trends reversing themselves in the short term. As long as economic doubts remain, bond yields could remain low and stocks could still have trouble seeing big gains. Reluctance to buy in an unstable housing market could push rents up further, and ongoing consolidation in the airline industry could further reduce capacity and give more support to airfares, boosting profits.

Long-term investors, on the other hand, should recognize that the economy tends to move in cycles. Even though interest rates are low now, the threat of higher rates at some point in the future, which could decimate the value of bonds bought today, should have you thinking twice about adding fixed-income exposure right now. Meanwhile, energy stocks have fallen to such an extent that they look like bargains based on many reliable metrics.

In other words, momentum traders may look for a short-term continuation of the trend. Longer-term investors, though, need to be realistic and recognize that eventually, the pendulum will swing the other way.

Keep on track
It's useful to look at your performance periodically to make sure you're staying in line with the overall markets in which you're invested. But focusing too much on returns based on just a few months can skew your perspective. Keep a long view on your investments, and you'll have a much greater chance of preserving your wealth and seeing it grow.

Buying great stocks on the cheap is always a smart move. Let Matt Koppenheffer show you five stocks that are cheaper than you think.