Ever since 1841, when a Scottish journalist named Charles Mackay published the book known today as "Extraordinary Popular Delusions and the Madness of Crowds," the answer has seemed clear. If you watch carefully for signs of euphoria, you can sidestep the damage when markets go mad.
But bubble spotting isn't as simple as Mackay made it sound—even, it turns out, for Mackay himself. Investors should always guard against the glib assertions of pundits who claim they can detect bubbles before they burst.
The great value investor Benjamin Graham suggested that investors should never have less than 25% or more than 75% of their money in stocks. He argued for reducing the allocation to stocks "when in the judgment of the investor the market level has become dangerously high." But, because no one can perfectly predict a bubble, you should never go either to zero or 100%.
After all, if identifying bubbles somehow became easy, investors would stop buying before prices got out of hand. So "being right about past bubbles does not automatically ensure that you will be right about the next," says Robert Shiller, the Yale economist who called both the Internet-stock and real-estate bubbles.