Learn · Bankroll
Dice bankroll management
Dice bankroll management means choosing bet sizes and stopping rules so that one session cannot cost more than you planned. It cannot change the house edge. It does decide how long a strategy lasts, how deep its drawdowns get and how much of a winning session you keep. This guide covers base bet sizing as a fraction of the bankroll, the losing streak each size survives, and how to write a stop loss and a profit vault in a Lua script.
Units as a fraction of bankroll
A unit is the base bet, expressed as a fraction of the bankroll you are willing to lose in the session. Sizing in fractions keeps the plan the same whatever the currency or balance: a script that sets basebet = balance / 1000 behaves the same on 0.01 BTC as on 1 BTC.
For flat betting, the fraction tells you directly how many losing bets the balance covers. One unit at 1/1,000 of the bankroll survives 1,000 straight losses, so if ruin comes, it comes from the slow pull of the house edge and normal swings. The expected value and variance guide shows how large those swings are.
For a progression, the unit is only the first step. Each loss multiplies the next bet, so what the bankroll has to cover is the whole losing sequence. That is where the base bet size matters most.
How base bet size sets the max survivable streak
The table uses a martingale at 49.5% (2x payout, 1% edge) that doubles after each loss and resets after a win. Each row divides the starting balance by a larger number to get the base bet. N is the longest losing streak the balance can pay for; the streak of N + 1 losses ends the run. Risk of ruin uses 1 − e^(−T / E_S), explained in the risk of ruin guide.
| Base bet | Max streak N | Chance of N losses in a row | Expected rolls to it | RoR 10,000 rolls | RoR 100,000 rolls |
|---|---|---|---|---|---|
| balance / 1,000 | 9 | 1 in 468 | 944 | over 99.99% | 100.0% |
| balance / 10,000 | 13 | 1 in 7,198 | 14,539 | 49.7% | 99.9% |
| balance / 100,000 | 16 | 1 in 55,890 | 112,908 | 8.48% | 58.8% |
| balance / 1,000,000 | 19 | 1 in 433,974 | 876,713 | 1.13% | 10.8% |
Cutting the base bet by a factor of 10 adds three or four survivable losses, because the bet doubles each time and 10 lies between 2³ and 2⁴. That moves N from 9 to 19 across the table and pushes the expected wait from about 944 rolls to about 876,713.
The cost is the size of each win. A martingale sequence that ends in a win nets one base bet, so the profit per session shrinks in proportion to the base bet. At balance / 1,000,000 and roughly 4,950 wins in 10,000 rolls, a surviving run gains about 0.495% of the balance. At balance / 10,000 it would gain about 49.5%, with a 49.7% chance of losing most of the bankroll first.
Stop loss and take profit with stop()
A stop loss ends the session once it has lost a set amount. A take profit ends it once it is ahead by a set amount. Both are a few lines in a DiceSim script, using the session variable profit and the function stop():
stop(): End the run after the current roll (halt reasonstop).profit: Session profit:balance + vaulted - starting balance.resetstats()re-bases it to 0.
chance = 49.5
basebet = balance / 1000 -- one unit = 0.1% of the starting balance
nextbet = basebet
local stopLoss = balance * 0.10 -- quit after losing 10% of the start
local takeProfit = balance * 0.05 -- quit after gaining 5%
function dobet()
if profit <= -stopLoss or profit >= takeProfit then
stop()
end
endThe top level of the script runs once, so balance there is the starting balance and both limits are fixed fractions of it. After every roll, dobet() checks the session profit and ends the run when either limit is reached.
With a progression, the check happens after the roll, so the last losing bet can push the loss past the limit. A martingale bet late in a streak can be larger than the whole stop loss. If the limit has to hold, also check the next bet before placing it, for example with if -profit + nextbet > stopLoss then stop() end after setting nextbet.
The flat betting script is a complete version with both limits as parameters.
What a stop rule changes
A stop rule does not change the expected loss per unit wagered. It changes the distribution of session results: a take profit turns many sessions into small wins, and a stop loss caps the size of the losing ones. It also ends sessions earlier, which lowers the total wagered and so the expected loss of each session.
Locking profit with vault()
The vault keeps part of the balance out of play. These are the engine's own descriptions:
vault(amount: number): number: Moveamountfrombalanceto the vault (clamped to the available balance). Vaulted funds count as profit but can never be lost. Returns the amount moved.vaulted: Total moved to the vault withvault(amount). Counts toward profit, cannot be bet.resetstats(): Zerobets,wins,losses,wagered, streaks and drawdown, and re-baseprofitto 0 from the current equity. Balance is untouched.
chance = 49.5
basebet = balance / 100000
nextbet = basebet
local lockStep = basebet * 100 -- bank profit every 100 base bets
function dobet()
if win then
nextbet = basebet
if profit >= lockStep then
vault(profit) -- move the session profit out of reach
resetstats() -- re-base profit to 0 so the next step starts fresh
end
else
nextbet = previousbet * 2
end
endAfter each win, if the session profit has reached 100 base bets, the script moves that profit into the vault and re-bases profit to 0 with resetstats(). Without the reset, profit would still include the vaulted amount and the script would vault again on the next win.
Vaulting changes the trade-off described above. The active balance stays near the starting balance, so N does not grow as profit accumulates, and a long streak still ends the run. What it takes is limited to the active balance, and the vaulted profit stays. DiceSim counts a run as bankrupt when the next bet is larger than the active balance, whatever is in the vault. The martingale with vault script is a ready-made version.
Why no sizing makes EV positive
Every bet has an expected result of −size × edge / 100. Bet sizing, stop rules and vaulting decide which bets are placed and how big they are. They can make losses smaller, rarer or more predictable, and they can make a typical session end in profit. They cannot make the sum of negative numbers positive. The house edge guide works through the arithmetic.
A sound plan sets a bankroll you can afford to lose, a base bet small enough that the worst likely streak is survivable for the session length, and stop rules that end the session before a bad run grows. The simulator stress test shows how the plan holds up across different seeds.
Try it
- Flat betting scriptFixed bet size with a stop loss and take profit written with
stop(). - Martingale with vaultA doubling script that moves profit to the vault with
vault(). - Risk of ruin calculatorCheck the survivable streak and risk of ruin for your own balance and base bet.
- Lua referenceEvery variable and function a DiceSim script can use, with examples.
FAQ
How much should my base bet be in dice?
Size it as a fraction of the bankroll and check how many losses in a row that fraction survives under your progression. With doubling on loss, each 2x reduction in the base bet buys roughly one more survivable loss.
Does a stop loss improve my odds?
It does not change the expected loss per unit wagered. It caps the amount a session can lose and ends the session sooner, which also reduces the total wagered.
What does vault() do in a DiceSim script?
vault(amount) moves funds from the balance to the vault. Vaulted funds count toward profit and can never be bet, so a later losing streak cannot take them.
Can bankroll management make dice profitable?
No. Bet sizing and stop rules decide how losses are spread over time and how large a single drawdown can get. The expected result of every bet is still set by the house edge.