Your numbers
What it says
Ready to go further
Next: see the whole spread of outcomes
Ruin is one edge of a distribution. The Monte Carlo simulator shows the final balance and the drawdown at five points from lucky to unlucky.
What is included
- The calculator, with your own numbers
- The formula written out
- A worked example you can reproduce
- Where grid, martingale and DCA bots break the maths
Who it is for
- People running or testing a trading bot
- Anyone sizing a position or checking costs
- Readers learning how the numbers work
- Not advice, and not for placing trades
Key facts
- Risk of ruin is the chance that a run of trades takes the balance down to a floor you choose, before the run ends.
- This tool runs 5,000 simulated sequences of trades with a fixed seed, so the same inputs always give the same answer.
- Model: each trade risks a fixed percent of the current balance. A win adds risk x payoff ratio, a loss takes away the risk percent.
- The model assumes independent trades and fixed odds. Costs are not in it unless the win rate and payoff you enter are already net of costs.
- Trades are capped at 1,000 so the page stays fast. 5,000 paths of 1,000 trades is five million steps.
- Example numbers on this page are made up. A good result here says nothing certain about a real bot.
How the risk of ruin calculator works
Risk of ruin asks one question: starting from today, what is the chance that bad luck alone takes the account down to a level I cannot accept? Here the level is the ruin floor, a percent of the starting balance. A floor of 50 means the account has halved. You pick it. Zero would mean total loss, which a percent-risk model never reaches exactly, so a floor above zero is more useful.
The calculator does not use a closed formula. It plays the strategy forward 5,000 times with a seeded random number generator (mulberry32, seed 123456789), so the answer is the same on every run and in every browser. On each path every trade is a win with the chance you set and a loss otherwise. The balance is updated trade by trade.
Loss: balance = balance x (1 - risk)
Ruin on a path = the balance is at or below floor x start at any trade
Chance of ruin = paths that hit the floor / 5,000
A worked example
Take a made-up strategy with a 40 percent win rate and a payoff ratio of 1.6, risking 2 percent of the balance per trade for 300 trades, with a floor of 50. A win adds 2 x 1.6 = 3.2 percent and a loss takes off 2 percent. The average result per trade is 0.4 x 1.6 - 0.6 = 0.04 times the amount risked, so the odds are positive. Even so, in the 5,000 simulated paths 6.2 percent fell to half the starting balance at some point. The median path ended at 115.4 percent of the start, the 5th percentile path at 56.0 percent, and the longest run of consecutive losses in any path was 26.
Now change only the size. At 1 percent risk the chance of touching the floor is 0.0 percent, at 4 percent it is 37.6, at 6 percent 61.4, and at 10 percent 86.0. The odds did not change. Only the share of the balance risked did.
A fixed check you can do by hand: with a 0 percent win rate, 35 losses at 2 percent leave 0.98 ^ 35 = 49.3 percent of the start, just under the floor, so ruin is certain. With 34 losses it is 0.98 ^ 34 = 50.3 percent, just above it.
What the model assumes, and where it breaks
- Trades are independent. Each trade has the same chance of winning whatever came before. Real markets have trends and quiet spells, so losses cluster more than coin flips do.
- The odds are fixed. The win rate and payoff do not change over the run. A strategy that stops working, or was overfitted to the past, does not stay at its backtest odds.
- Size is a fixed percent of the current balance. The bet shrinks after a loss and grows after a win.
- Costs are only in if you put them in. Enter a win rate and a payoff ratio that are net of spread, commission and slippage.
- Losses are the size you entered. Gaps and stop failures can make a real loss larger than planned.
Why martingale and grid win rates do not fit
A martingale bot often reports a win rate above 90 percent. Typing that into this tool gives a misleading picture, because the model breaks on both assumptions. The bot's trades are not independent: its next size depends on the last result, and the one big loss is the end of a ladder the earlier wins were the first steps of. And the size is not a fixed share of the balance, since it doubles after each loss. Run the ladder through the martingale calculator instead and look at the margin. For the odds of long losing runs, the guide risk of ruin has the arithmetic.
Reading the other tiles
The median final balance is the middle path. Half the paths ended below it. The 5th percentile shows the bad end: one path in twenty did no better. The longest losing run is the longest in any of the 5,000 paths, so it is larger than what you would see in one run. A run that long is not unusual across many trades, which is why a losing streak that "should never happen" appears in practice. To see the full range of outcomes, use the Monte Carlo simulator. To check that the odds are positive before anything else, use the expected value calculator.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
Why does the answer not change between runs?
The simulation uses a fixed seed, so the same inputs always give the same answer. That makes it testable. It also means the figure is one sample of 5,000 paths, so it can differ from the true chance by a percent or two.
What floor should I use?
The one that matches what you could accept, such as 50 for a halved account or 80 for a fifth gone. Pick it before you run the tool, not after, so the answer is not shaped by what you hope to see.
Why is the maximum 1,000 trades?
The simulation runs in your browser. At 5,000 paths of 1,000 trades it is five million steps, which takes well under a second on most devices. More would slow older phones.
Does a positive average result mean the chance of ruin is zero?
No. The default example has a positive average and still touches the floor in some paths. Size and luck decide that, not only the odds.
Can I use it for a martingale or grid bot?
Not reliably. Those bots win often, lose rarely and lose big, and their size depends on earlier results. This model assumes independent trades and a fixed share of the balance. Use the martingale calculator and look at margin instead.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is a calculator and general education. It does not consider your situation, and its answers are only as good as the numbers you enter.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss