If you think you're a great investor, or even a moderately competent one, perhaps I can challenge you to a little game.

It consists of nothing more than flipping a computer-simulated coin for 30 minutes. You begin with an imaginary bankroll of $25. Before each flip, you choose how much of your make-believe stash to bet on the outcome.

Oh, and there's one other thing: Unlike a real coin toss, where the outcome is a 50-50 bet, the odds in this simulation tilt in your favour because the coin is biased. You're told at the start of play that there is a 60-per-cent chance it will come up heads.

Nothing sounds simpler than winning at such an outrageously rigged game. Yet, when it was played with real money in a controlled experiment, a surprising number of professional investors and finance students somehow managed to go bust. Full confession: I didn't do so well myself.

Ready to take the challenge? Great. Before reading any further, go to coinflipbet.herokuapp.com/ and start flipping. I'll wait.

Dum-de-dum, dum-de-dum … back again? I hope you agree the coin-flip experiment was an oddly intriguing experience. I hope, too, that you see the parallels to real-world investing. In the course of half an hour, you encountered many of the same challenges that sabotage many actual portfolios.

For instance, there's the knotty problem of deciding how much you should bet on a proposition that tilts in your favour over the long run, but in the short run is far from a sure thing – much like the stock market itself.

Given the odds in the coin flip game, all of us can see it makes sense to favour heads. The problem is deciding how much of our bankroll we should risk on each flip of the coin. Choosing the right amount to wager is similar to deciding how much of your actual portfolio to devote to a promising stock or fund.

Then there are the inevitable ups and downs of the game. Throughout half an hour of coin flipping, you probably hit at least one sorry patch when you found your bankroll melting away despite your best efforts. When that happens, the temptation to do something – anything – to break the losing streak becomes nearly unbearable.

How unbearable? By the 15-minute mark, I was swearing at the screen. I had begun by betting $5 a flip on heads, but my first three tosses came up tails and quickly dragged me down to $10. I then sliced my bet in half, then in half again, but I couldn't get any traction. I wound up with the distinctly unimpressive total of $3.85.

At least I wasn't alone. The two creators of this experiment, Victor Haghani of Elm Partners and Richard Dewey of Pimco, found 28 per cent of their test subjects went bust when playing the game with real money. A full third of their test subjects wound up with less money than their starting amount.

The results are startling because all 61 subjects in the initial experiment were either young money managers or university students in economics. They all had the training to play the game intelligently, but most of them flopped.

Bettors sabotaged themselves in many ways – by overbetting, by underbetting, by shifting bets erratically (the latter was probably my own undoing). Amazingly, two thirds of the test subjects bet on tails at some point despite the miserable odds against that outcome. And nearly a third of them gambled everything on a single coin flip at least once.

They should have done much, much better. I should have, too. The ideal strategy for playing the game is described by a mathematical calculation known as the Kelly criterion.

Essentially, it consists of betting a constant fraction of your bankroll on each flip. The fraction is tied to your probability of winning. Given the specific odds in the coin-flip game, a truly astute player would have wound up betting one fifth of his or her bankroll on each toss – and would have been expected to win $3.2-million in half an hour of tossing the loaded coin.

To avoid bankrupting themselves, the experimenters limited the maximum payout to $250 a person. But only 13 of their subjects hit even that relatively low ceiling – a dismal showing indeed for a group of supposedly smart, well educated investment professionals.

Mathematically inclined folks may see the results as a reason to learn more about the Kelly criterion and that's certainly a worthwhile resolution. But even those of us who count on our fingers can take away important lessons.

To my mind, the single most valuable insight is that it's discipline that counts in investing, not brilliant investing ideas. The subjects in the coin-flipping contest knew that betting on heads was a great proposition, but most failed to reap a reasonable reward because they didn't stick to a simple, consistent strategy that realistically balanced risk and reward.

Of course, I put my own failure down to bad luck. But just in case, I'm taking an extra hard look at my portfolio allocation and pondering ways to take a more rigorous attitude toward sizing my various investment bets. It's amazing what a coin flip can teach you.