When you hear advice to buy index funds, that usually comes with two additional pieces of investment discipline advice that are important:
- dollar-cost-average
- diversify across asset classes and then rebalance regularly
These two elements are important to give you relative predictability in your outcome 20 years from now.
In this old blog post of mine I linked to Warren Buffett talking about this, also
mentioned it in a comment on another answer: http://blog.ometer.com/2008/03/27/index-funds/
It's perfectly plausible to do poorly over 20 years if you buy 100% stocks at once, without dollar-cost averaging or rebalancing. It's very very very plausible to do poorly over 10 years, such as the last 10 in fact. Can you really say you know your financial situation in 20-30 years, and for sure won't need that money?
Because predictability is important, I like buying a balanced fund and not "pure stocks": http://blog.ometer.com/2010/11/10/take-risks-in-life-for-savings-choose-a-balanced-fund/
(feel a little bad linking to my blog, but retyping all that into this answer seems dumb!)
Here's another tip. You can go one step past dollar cost averaging and try value averaging:
http://www.amazon.com/Value-Averaging-Strategy-Investment-Classics/dp/0470049774
However, chances are you aren't even going to be good about rebalancing if it's done "by hand," so personally I would not do value averaging unless you can find either a fund or a financial advisor to do it for you automatically. (Finance Buff blog makes a case for a financial advisor, in case you like that more than my balanced fund suggestion: http://thefinancebuff.com/the-average-investor-should-use-an-investment-advisor-how-to-find-one.html) Like rebalancing, value averaging makes you buy more when you're depressed about the market and less when it's exciting. It's hard.
(Dollar cost averaging is easily done by setting up automatic investment, of course, so you
don't have to do it manually in the way you would with value averaging.)
If you read the usual canonical books on index funds and efficient markets it's easy to remember the takeaway that nobody knows whether the market will go up or down, and yes you won't successfully time the market. But what you can do successfully is use an investment discipline with risk control: assume that the market will fluctuate, that both up and down are likely and possible, and optimize for predictability in light of that. Most importantly, optimize to take your emotions and behavior out of the picture.
Some disciplines for example are:
- index fund plus diversification plus rebalancing plus dollar-cost/value averaging
- "value investing" in Benjamin Graham / Warren Buffet sense with margin of safety, willingness to hold cash or bonds, and high deviation from index benchmarks. it's hard to tell which managers truly stick to this discipline, so index funds are much more reliable. and few people have the temperament and expertise to do this themselves. think "years of intense study and zen calm while losing tons of money"
- John Hussman's dynamic hedging based on normalized valuation and other statistical analysis http://hussmanfunds.com/ (this is an obscure one, just pointing it out as an example of a discipline)
- use options to put a collar around an equity index fund; there used to be a no-load fund called the Gateway Fund that did this, but it now charges a load, sadly. There's also a Bridgeway Balanced fund that does it or something similar, I think.
there are dozens out there, many of them snake oil, I think these I mentioned are valid. Anyway, you need some form of risk control, and putting all your money in stocks at once doesn't give you a lot of risk control.
There's no real need to get creative. A balanced fund that uses index funds for equity and bond portions is a great choice.