Just as a harmless dose of an infection like measles can prevent a major illness, so stock market disasters could be avoided by deliberately triggering mild share price dips, says a team of Oxford mathematicians.
Michael Hart and colleagues produced a computer simulation of the stock market mimicking a group of traders who buy and sell shares.
Each time the model was run, the virtual traders made different decisions and the stock market index traced a different path.
Some paths just wobbled up and down with no major fluctuations while others eventually dived into a catastrophic crash.
Hart's team found that paths which eventually crashed tended to have an above-average number of upward movements in their history before the crash. Those that avoided crashing experienced more downward movements over a similar period.
Small drops appeared to take tension out of the system and allowed the market to ride a period of instability.
The researchers hope the system could be applied to the real world to spot major dips looming in the stock market and prevent them happening.
Running the model a number of times it would be possible to look ahead at different potential stock market futures. If all the paths pointed down, it could be assumed that the market was heading for a crash.
The scientists envisaged regulators who would monitor the computer models.
"If they see the warning signal of converging paths, then they step in and 'immunise' the market," said Hart.
To do this, a regulator could sell small amounts of stock enough to force the market down but not make it crash.
Another, less likely, control would be laws forcing major market movers to adjust their positions in the market by buying or selling stock.
Ton Coolen, an applied mathematician at King's College London, said it might prove impossible to apply the model to the real market.
"Computing all the possible future world lines for the stock market would require getting inside traders heads to see how they think," he said.