Introduction to Quant Finance · Lesson 19
Ruin
Why doubling down goes broke: a rule that wins almost every round and still loses the whole account.
Know the basics? Read the lesson notesA rule for how much to put on a trade
Every trade in this lesson is a fair coin: it wins half the time. What you put on one trade is the stake. A win pays you the stake, a loss takes it.
We count in R, and here 1R is the first stake. The account starts at 100R. The rule only decides the stake: start at 1R, double the stake after every loss (people call this doubling down), and go back to 1R after every win. Flip ten times.
Next stake 1R
Trade 0 · account 100R
Each chip is a trade's stake in R: + won, − lost. A bar marks a new round.
Ten trades and the account is at 102R. Look at what each win did. Lose 1R, lose 2R, then win 4R: −1 − 2 + 4 = +1R. However many losses came first, the win paid them all back plus 1R. Right now it is two losses deep, so the next stake is 4R. You'll carry on with this account in a few screens.
The ladder
A round runs from a 1R stake to its first win, or until the account is broke. Each doubling of the stake is one rung of a ladder: 1R, 2R, 4R and so on. As long as the account can pay for the next rung, a round that ends in a win ends 1R up, because each new stake is exactly 1R more than all the losses before it put together. The account can pay for a stake if the stake is no more than what is left. The ladder is as long as the account can pay for, so a bigger account affords more rungs.
The catch is in the losses. Start a fresh round with 100R and press Lose. Each press is one more loss in a row.
One round of the doubler, from 100R
Left: what is left in the account. Right: the stake lost on each trade.
Six losses in a row cost 1 + 2 + 4 + 8 + 16 + 32 = 63R. That leaves 37R, and the seventh rung should be 64R. The ladder has run out.
Our doubler then stakes everything that is left, which is called going all-in. If the all-in trade wins, the 37R doubles to 74R. If it loses, the account is at 0R. An account at 0R can't trade again: it is broke. Losing everything like this is called ruin.
So a round can end two ways. A won round is one where the ladder held: the win paid back every loss and the round ends 1R up. A lost round is one where the ladder ran out: the all-in trade then decides whether the account is broke or only far down, like 74R from 100R.
How rare is it for the ladder to run out?
From 100R, the ladder runs out after six losses in a row. A fair coin loses half the time, and one flip doesn't change the next. So six losses in a row is a half, then a half of that, six times over.
Back to your account
Your account was at 102R after ten trades, two losses into a round, with a 4R stake next. Carry on flipping.
Next stake 4R
Trade 10 · account 102R
Each chip is a trade's stake in R: + won, − lost. A bar marks a new round.
The account reached 108R on trade 14. Then seven losses in a row: six used up the ladder, and the seventh took the last 45R, staked all-in where the ladder wanted 64R. Broke on trade 21, after winning every round but one.
A guess before we go big
Now 10,000 accounts, each with 100R and the same doubling rule, each flipping its own fair coin for up to 1,000 trades. An account that goes broke stops. After 1,000 trades, what share of them are broke?
10,000 accounts, 1,000 trades
The chart draws 200 of the accounts. The counters below it count all 10,000. The coloured line is one account you can follow. Your own account from earlier broke on trade 21; press Follow another account to switch. Start with Play.
The doubler, 10,000 simulated accounts
Account in R, one line per account, 200 of them drawn. A line that hits 0R is broke and stays on the floor; a dot marks where it fell, darker where several fell close together.
At trade 1,000, 81.2% of the accounts were broke. Over the same accounts, 99.2% of the rounds that finished were won: accounts that grew could pay for longer ladders, so their rounds failed even less often than 1 in 64.
Both numbers are true at once. A won round adds 1R; a lost round takes a big part of the account, and about half the time all of it (the all-in trade is one more coin flip). A new round starts after every win, so an account that lasts 1,000 trades plays about 500 rounds, and most accounts meet a losing run their ladder can't pay for long before then. The broke share was still rising when we stopped.
For the precise
All 10,000 accounts together finished 1,971,686 rounds: 1,955,883 won and 15,803 lost. Of the trades they took, 50.0% were wins, as a fair coin gives: the stakes changed, the coin didn't. Half of the accounts that went broke were broke by trade 173. The biggest single stake was 256R. The middle survivor finished 507 rounds.The same coins, a flat stake
Now give the same 10,000 accounts the same coins, trade for trade, with one change: the stake is always 1R. Switch between the two rules.
Two of the numbers below need a word. Line up all 10,000 accounts from poorest to richest: the middle account is the one in the middle (the median). The average account adds them all up and divides by 10,000.
Two stake rules, the same simulated coins, after 1,000 trades
With flat stakes, 0.1% went broke and about half ended below the start. A fair coin has no edge: on average a trade makes nothing. A coin with an edge wins more than half the time, so each 1R staked makes something on average. With no edge, luck alone leaves about half the accounts up and half down. The middle account is still at 100R. Under the doubler, the middle account is at 0R.
The averages barely differ: 97.7R and 99.9R, both 100R give or take luck. On a fair coin no stake rule changes the average. It only changes who ends up with it. Under the doubler, most accounts lose everything and the few that survive end far above 100R.
The martingale, for any account
Doubling the stake after every loss is an old betting system called the martingale. Two rules describe it for any account.
The ladder. The stakes go 1, 2, 4, 8R and so on, so k losses in a row lose 1 + 2 + 4 + … up to the k-th stake. That total is always one less than the next stake (1 + 2 + 4 = 7, one less than 8): 2k − 1. On a fair coin, a round starts with k losses in a row with chance ½ multiplied k times. An account of B pays for the largest k whose total still fits in B.
The average. A trade with stake s wins s half the time and loses s half the time, so on average it makes ½ × s − ½ × s = 0, whatever s is. A stake rule only decides which trade gets which stake. Every trade still averages 0, so the total averages 0 too. That is why the doubler and the flat rule both averaged about 100R. The stake rule changes the shape of the results (many small wins, a rare wipe-out), never the average.
P = (½)k, one round in 2k
r = the largest k with 2k − 1 ≤ B
Pbroke = (½)r+1, one round in 2r+1
average of a trade = ½ × s − ½ × s = 0
- k
- losses in a row, counted from the round's first 1R stake
- L
- what those k losses lose together, in R
- P
- the chance that a round starts with k losses in a row, on a fair coin
- B
- the account at the start of the round, in R
- r
- the rungs the account pays for in full
- Pbroke
- the chance a round ends broke: its r rungs and the all-in trade all lose. (If B is exactly 2r − 1, nothing is left for an all-in trade and Pbroke = (½)r.)
- s
- the stake of one trade, in R
Your account started at B = 100R. For k = 6: 26 − 1 = 63, which fits in 100. For k = 7: 27 − 1 = 127, which doesn't. So r = 6: six losses in a row lose 63R and leave 37R, and a fair coin starts a round that way (½)6 = 1 time in 64. Going broke also needs the all-in seventh trade to lose: Pbroke = (½)7, 1 in 128.
At 1 in 128, each round survives with chance 127/128, and about 500 rounds multiply: 1 − (127/128)500 ≈ 98% broke. Our accounts did better, 81.2%, because each won round adds 1R, and an account that grows to 128R or more pays for a seventh rung with at least 1R left for the all-in trade, which halves its chance per round to 1 in 256.
The average: if a round stopped after those six rungs, then out of 64 rounds, on average 63 would win 1R and one would lose 63R. 63 − 63 = 0.
- each trade wins half the time, and one flip doesn't change the next;
- the stake is set before each flip;
- a win pays exactly the stake and a loss takes it, with no costs;
- the stakes stay within what the account can pay, and the trading stops at some point.
The coin isn't fair. Then a trade averages its stake times the edge per 1R staked, so the stake rule does change the average: costs make the edge negative and every extra rung makes the average worse (lesson A16, Costs); with a real edge, how much to stake is Kelly (lesson C10).
A friend starts the same doubler with 500R. How many losses in a row use up its ladder: the most rungs it can pay for in full?
What this means for your backtest
A backtest runs a rule over past data, trade by trade, to see what it would have done. A backtest of a rule that raises its stake after losses can look superb. Three habits follow. Turn them over one at a time.
- Read the stakes, not only the share of rounds won.
A rule that raises its stake after losses wins most rounds by design, so a high share of rounds won tells you little. Find the biggest stake it placed and set it beside the account. From 100R, the sixth loss in a row is already a 32R stake, and the seventh stake would be 64R.
- Ask how many losses in a row the test met.
The doubler from 100R can pay for six losses in a row, and the seventh loss in a row (the all-in trade) leaves it broke. A backtest that never met a run that long never tested the rule.
- Don't trust a good early stretch.
Between its long runs of losses, a doubler's account climbs smoothly, 1R a round, so a short backtest mostly shows the climb. Your account from earlier stood at 108R on trade 14 and was broke on trade 21.
One last check
In the 10,000 accounts, 99.2% of the rounds were won and 81.2% of the accounts went broke. What makes both true?
The bot that almost never loses
Which question tells you most about this bot?
A bigger account
When the ladder runs out (the next stake no longer fits), how much has the round lost? Type it in R.
Hint: add the rungs 1 + 2 + 4 + 8 + … while the total still fits in 1,000R. The next rung is the one that doesn't fit.
Your own backtest
What does this backtest tell you about the rule's risk?
Lesson done
Doubling the stake after every loss wins almost every round, 1R at a time. The first time the losses in a row outrun the money, it must stake everything left, and a loss there takes the whole account. It can't make a fair coin pay; it only decides which accounts end up with the money. When a backtest raises its stake after losses, judge it by its biggest stake and the most losses in a row it met, not by its share of rounds won.
Key ideas
- Stake
- what you put on one trade: a win pays it, a loss takes it
- Martingale
- double the stake after every loss, back to 1R after a win
- Round
- from a 1R stake to its first win (won, 1R up) or to broke; lost if the ladder ran out
- Rung
- one doubling of the stake; the account pays for only so many
- Edge
- what each 1R staked makes on average; a fair coin has none
- Ruin
- losing the whole account: a broke account can't trade again
Formulas
k losses in a row lose 2k − 1 (in R)
chance on a fair coin, from a round's start: (½)k
rungs an account B pays for: the largest k with 2k − 1 ≤ B
chance a round ends broke: (½)r+1 for r rungs; (½)r if B = 2r − 1 exactly
average of one fair trade: ½ × s − ½ × s = 0, for any stake s