Afraid of heights? If so, I'd suggest you not look back over the past few months.

After a sharp sell-off that started in April, the market got some color back in its face. The S&P 500 shot up nearly 19% between early July and yesterday's close. The market's momentum has been fueled by the fact that Europe didn't end up turning into a black hole, investors are more sanguine about the U.S.'s economic prospects, and the Federal Reserve is jamming down the monetary gas pedal.

But the big gains over the past few months have some investors starting to ask how much longer this can continue.

They have a point
From a psychological perspective, investors are still more fragile than mom's good china. Strong corporate earnings and the promise of the Fed's QE2 kept investors' hearts a-flutter recently, but earnings season is winding down, and the Fed's stimulus pledge is now in the rearview (yes, the actions are still yet to come, but the market has already built them in). You can almost feel it in the air that investors are ready to shed some of the optimism and start nervously chewing their nails again.

Meanwhile, from a valuation perspective, the rally has had a pretty straightforward effect on stocks. Higher prices now mean (mostly) higher valuations, and as stock prices go up, implied returns go down.

From a macro perspective, a lot depends on which valuation church you tithe. For those who think historical valuations going back as far as early last century are still meaningful today, the market is looking fairly pricey. Robert Shiller's CAPE -- or cyclically adjusted price-to-earnings ratio, a long-term measure of valuations -- is pushing 22, which is uncomfortably above its long-term average of 16.4. On a single-year basis, the S&P 500's P/E is currently a hair under 17, which is also above its long-term average of 15.

If, on the other hand, you believe that changes in markets and risk perception mean that early 1900s P/E multiples are less meaningful today, then today's multiples don't look quite as scary. Over the past 50 years, Shiller's CAPE has averaged 19.4. That still means that today's 22 is high, but it hasn't overshot by quite as much yet. On a single-year basis, the 50-year average P/E is 17.8, still a bit above where we're currently sitting.

But no matter which camp you're in, it's much harder now to make a case that the broad market is overly cheap.

Staying on the right track
For long-term investors though, there's no reason to start panicking, losing sleep, or spending all of your milk money on Tums. Instead, follow these four steps, and you'll make sure that your portfolio is set for the time-frame that you really care about: the long term.

  1. Cut the fat. Rallies can be a great time to jettison stocks that you know you shouldn't be hanging onto. These may be stocks with insane valuations, or they may just be bad companies, but either way, the run-up can make it easier to part ways.
  1. Hang on to the good stuff. For investors with an eye toward years and decades, the real money is in letting the good companies that you own grow and compound your gains. Buying and selling too often doesn't give you the opportunity to harvest those bigger, get-rich-slow types of profits. I own both Coca-Cola (NYSE: KO) and McDonald's (NYSE: MCD) in my personal portfolio. I don't find the current price on either overly attractive, and I'm not interested in buying more. But I think both are great companies, have solid futures ahead, and are willing to pay me a decent dividend to hang around. As a result, I'm in no rush to kick them out of my brokerage account.
  1. Keep digging. I've never been a big fan of Jim Cramer's saying, "There's always a bull market somewhere," but I could get on board with a slightly modified version: "There's always an undervalued stock somewhere." Here are a few of the stocks that are still on my "buy" radar:
Company

Return on Capital

Forward P/E

Dividend Yield

Abbott Labs (NYSE: ABT)

10.9%

11

3.5%

Lockheed Martin (NYSE: LMT)

32.9%

10.7

4.1%

Kimberly Clark (NYSE: KMB)

15%

12.8

4.2%

Sysco (NYSE: SYY)

19.6%

14.3

3.4%

Public Service Enterprise (NYSE: PEG)

10.5%

11.6

4.2%

Source: Capital IQ, a Standard & Poor's company.

All of the above companies have proven over many years that they know how to crank out profits for their shareholders. Better still, they all recognize the importance of letting shareholders participate in their success through dividends. And better still, I think the valuations on all of these stocks still make them buyable today.
  1. Be patient. Lately, the market seems a lot like the weather in Florida: Wait just a bit, and it'll change. If you're on board with the three steps above, then you've got some great companies in your portfolio already. But nobody says you have to have all your chips in the pot at all times. If you keep some extra cash on the sidelines, you'll have it available to scoop up some freshly discounted stocks if the market does decide to back off from the recent rally.

Looking for more stocks that you can buy right now? My fellow Fools think that five stocks that The Motley Fool owns are stocks that you should own, too. To get the free report, just click here and enter your email address.