In a series of famous experiments, researchers trained pigeons to peck at coloured lights by rewarding them with pellets of food.

The experiment was set up so that pecking the green light delivers food 60% of the time, but the red light delivers food on only 40% of pecks.

Over time, pigeons experience the differences in the probability of winning food from each light, and adapt their choices in response. This is similar to the experience of an investor trying to decide on a month-by-month basis whether to be in the market or out of it. Most developed world equity indices - for example, the MSCI World USD - post gains around 60% of months, with losses the other 40%.

When pigeons encounter this problem they display behaviour that psychologists call probability matching: they gradually learn the probabilities of getting food from the green and red light and, over time, they tend towards pecking the green light 60% of the time, and the red light 40% of the time. Given a similar task, humans also have a tendency towards probability matching - in many areas of their lives - and the investing world is rife with those attempting to time the market by flipping between 'risk on' and 'risk off' on a monthly basis. The trouble is, when the process that generates the result is essentially random, probability matching, as a strategy, falls short.

When you have little way of knowing whether the next result will be up or down, the best solution is to always pick the light with the highest probability. Pigeons (or traders) who peck green at every opportunity will be right 60% of the time. Any deviation from this strategy is likely to reduce your pay-off. So what can this tell us about market timing?

Faced with a random process, the strategy of probability matching results in success 52%, rather than 60% of the time. So the tendency of both humans and pigeons leads them to be wrong on 8% more occasions than they should be if they followed a simple strategy of sticking to the option with the best long-term odds (i.e. buy and hold).

Of course, the markets are not entirely random, and tactical shifts in a portfolio can pay off - but only if an investor has sufficient skill (and even then it is not guaranteed). So don't try this at home!

A strategy that aims to beat the market by making large changes on a month-by-month basis will very likely fall short of one that looks for long-term trends and sticks with them - in short, just keep pecking the green button! Leaping between 'risk on' and 'risk off' is betting against the house...with the odds very much against you.

According to the annual Barclays Equity Gilt Study, an investor holding shares for 10 consecutive years has had a 79 per cent chance of outperforming gilts over those 10 years. Over 20 years, equities have produced annualised real returns of 4.1 per cent (gilts have made 3.5 per cent).

Historically, the longer investors have held shares, the greater their chances of generating greater returns than they would have done with an equivalent investment in bonds

So long-term investors can take comfort in the fact that, if they're in the market, the odds are stacked firmly in their favour.

Greg Davies is Head of Behavioural and Quantitative Finance at Barclays