The theory
Over the year, markets rise and fall. This is only a problem if you need access to your investments at short notice and you're forced to sell after a fall in the market - as you'll be locking in your losses.
Having some cash set aside, ideally somewhere between 6-12 months of normal expenses, will allow you to wait out a market downturn and hopefully sell at a better time.
How it works in practice
This example is based on a balanced portfolio, but other variations would perform differently.
In the chart below, the blue lines show the returns each year from a balanced portfolio of shares and bonds.
The red dots show the biggest top-to-bottom fall for the portfolio in each year.
As you can see, even when there were substantial top-to-bottom falls within a year, this example of a balanced portfolio often managed to recover enough to post a positive overall return by the end of the year.
It's a good idea to keep some cash in reserve to cover any unexpected expenses so that you're not forced to sell any of your investments at short notice. This will help you avoid the worst falls.