The ink is barely dry, but a recent quote from my fellow Fool Morgan Housel is already one of my favorites:

Not a single investor in today's market practicing legitimate buy and hold in a low-cost index fund has ever lost money. Not one.

This comment is insightful, and humbling, yet it should almost be obvious. History has shown that those who attempt to dance in and out of the market are repeatedly burned and often lose money or miss bull markets. But it's important to recognize the difference between those who choose to sell their holdings because of fear or greed and those who need to sell to buy a house or pay for college.

Man holding on to pole in storm

Sometimes, a "hold" strategy is the only way to go. Image source: Getty Images.

Investing vs. saving
At its core, the main purpose of investing, as opposed to strictly saving, is to grow one's funds and hopefully achieve a reasonable return, which can then be used to increase one's standard of living.

While Morgan's point that anyone who has purchased a low-cost S&P index fund and never sold it hasn't lost money is fascinating, it may not be realistic or applicable for many investors. Some investors are wealthy enough to never sell and to pass their investments on to their heirs, but most need to liquidate holdings to fund their lives at some point in time.

So how long should investors hold on before selling to give themselves the best odds for success?

What gives me the best odds?
Let's go back in time to 1950 and implement a five-year holding-period strategy, assuming low-cost index funds were available back then. In our example, an investor buys a S&P 500 index on the first trading day of 1950 and sells it on the first trading day of 1955. At the end of the holding period, the S&P 500 has increased in price 121%, excluding dividends.

Now, let's repeat that example every day and assume someone buys the same index fund on the second trading day of 1950, or third, or fourth, ad infinitum, and always holds it for five years and then sells. The last hypothetical purchase would be in May 2008.

This scenario gives us 14,691 days of unique returns. If an investor was strictly practicing our five-year holding period strategy, he or she would have experienced a capital loss 2,879 times, or 19.6%. Those are pretty good odds, but far from bulletproof.

Holding for 10 years
Let's try a 10-year holding period strategy with the same index fund with purchases starting on the first trading day in 1950 and then on the second, or third, or fourth, ad infinitum, and always holding it for 10 years and then selling. The last hypothetical purchase would be in May 2003.

Here, we have unique returns for 13,431 days. If an investor was strictly practicing our 10-year holding period strategy, he or she would have experienced a capital loss 1,176 times, or just 8.8%.

Let's go a little longer
Key takeaways so far: Holding on another five years or starting five years earlier in the past have significantly pushed the odds in your favor. In regard to starting earlier, for those who have 20, 30, 40 years of investing ahead of them, the future looks even brighter.

Using the same example, now using a 20-year holding period, we get a sample size of 10,688 days. Number of times that investors would have experienced a capital loss: 0 days. Zero.

So what? What will the next 20 years look like?
Are these results from a time of essentially continuous growth in the United States and the modernization of the stock market? Yes. Are future returns guaranteed to look similar? No. Does anyone really know? Of course not.

The stock market could be lower in 20 years -- but it has never happened in the past. Booms will come, and busts will follow, but if you can broaden your time horizon by holding on longer or starting earlier and strengthening your stomach, the odds are in your favor.