Skip to content
DiceSim

Fibonacci · 49.5% chance

Fibonacci dice strategy script (Lua)

The Fibonacci dice strategy sizes each bet as the base bet times a number from the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13 and so on. This script bets 49.5% for a 2.00x payout, moves one step up the sequence after a loss and two steps back after a win, and never goes below the first step.

The bet grows more slowly than with martingale. With the default base bet a 0.01 balance covers 18 losses in a row, where the basic martingale script on the same balance covers 13. In exchange, from 3 losses in a row on, one win no longer pays back the run.

The script

Lua 5.4 with DiceBot-style globals. The top level runs once to set chance and the first nextbet, then dobet() runs after every roll. Every global is described in the Lua reference.

luafibonacci.lua
-- Fibonacci (one step up on a loss, two steps back on a win)
-- Bet basebet times a Fibonacci number: 1, 1, 2, 3, 5, 8, 13, 21 ...
-- After a loss move one step up the sequence, after a win move two steps back, never
-- below the first step. The bet grows much slower than a doubling martingale, but after
-- 3 or more losses a single win no longer pays back the run; it only moves two steps down.

chance  = 49.5
bethigh = false

basebet = params.basebet or balance / 10000
nextbet = basebet

local fib  = { 1, 1 }   -- the sequence, extended as needed
local step = 1          -- current position in the sequence (1-based)

local function fibAt(k)
  while #fib < k do
    fib[#fib + 1] = fib[#fib] + fib[#fib - 1]
  end
  return fib[k]
end

function dobet()
  if win then
    step = math.max(1, step - 2)
  else
    step = step + 1
  end
  nextbet = basebet * fibAt(step)
end

How it works

  1. chance = 49.5 and bethigh = false win on a roll below 49.5, paying 2.00x.
  2. basebet is params.basebet or balance / 10000, which is 0.01% of the starting balance.
  3. fib holds the sequence, starting as { 1, 1 }, and step is the current position, starting at 1. fibAt(k) appends numbers to fib until it has k of them, then returns the kth.
  4. After a win, dobet() sets step = math.max(1, step - 2). After a loss it adds 1 to step.
  5. Then it sets nextbet = basebet * fibAt(step). A losing run from the start bets 1, 1, 2, 3, 5, 8 base bets and so on.
  6. There is no stop rule. The run ends at your roll count, when you stop it, or when nextbet is larger than balance.

Risk at a glance

Settings: 49.5% chance, 1% house edge, starting balance 0.01 (the template default, BTC in the simulator), base bet 0.000001 (balance / 10000).

Payout2.00x(100 - 1) / 49.5
Single ruin streakNoneThis script can run out of money without one long losing streak, so no single streak length marks the end. See the table below.

The calculator's model multiplies the bet by a fixed factor after a loss and resets it after a win. Here the bet follows the Fibonacci numbers and a win only moves it two steps back, so that model does not apply. The table shows a straight losing run from a fresh start. The 0.01 balance covers 18 such losses. A run can also end without one long streak: over any stretch with more than two losses per win the bet keeps climbing the sequence.

Cost of a straight losing run from a fresh start
Losses in a rowChance of the streakResult from a fresh start
101 in 927 (0.108%)Lost 0.000143 (1.4%), next bet 0.000089
151 in 28,225 (0.0035%)Lost 0.001596 (16.0%), next bet 0.000987
181 in 219,157 (0.00046%)Lost 0.006764 (67.6%). The next bet, 0.004181, is more than the 0.003236 left
201 in 859,355 (0.00012%)Out of money after 18 losses

Theoretical figures for a fresh start, not a simulation. The chance of N losses in a row is qN with q = 1 - chance / 100, the same formula the dice calculator uses. None of this changes the expected result: at a 1% house edge the average loss is 1% of the total wagered, whatever the progression.

Tuning it

Each setting below is read as params.name or default, so the script runs with the default until something passes a value in.

Parameters read by the Fibonacci script
ParamDefaultWhat changing it does
params.basebetbalance / 10000Bet at the first step and the unit for every other step. Each Fibonacci number is about 1.6 times the one before, so halving the base bet buys roughly one more loss in a row.

The step sizes are not params values. To move back one step after a win instead of two, change step - 2 to step - 1 in dobet(). The bet then stays higher for longer after a losing run.

FAQ

Does the Fibonacci strategy beat the house edge on dice?

No. The sequence only decides how much to bet. Each roll still wins 49.5% of the time, and at a 1% house edge every bet loses 1% of its size on average, so over many rolls the expected result is a loss of about 1% of the total wagered.

Do two wins in a row win back a Fibonacci losing run?

Only after a short run of up to 4 losses. After 10 losses in a row from the start the bets have cost 143 base bets. The next bet is 89 base bets, and after a win the one after that is 34, so two wins bring back 123 and leave the session 20 base bets down. Each further win moves the bet two more steps down the sequence.

How many losses in a row can the default bankroll take?

18 from a fresh start. Those bets add up to 6,764 base bets (0.006764) out of 10,000, and the next bet of 4,181 base bets is more than what is left. The chance that 18 given rolls all lose at 49.5% is 1 in 219,157.

Can I run this script in DiceBot or another Lua dice bot?

The script uses the global names from Seuntjie's DiceBot (chance, bethigh, nextbet, previousbet, win, dobet()). The params table only exists in DiceSim, so replace each params.name or value with the value before you paste it into another bot. DiceSim itself never places bets on a casino.

Other scripts

Martingale

Doubles the bet after each loss and goes back to the base bet after a win.

Chance
49.5%
Type
Martingale

Delayed escalation

Bets 3.35% for a 29.55x payout. Flat bets through 50 losses, then 4% more per loss.

Chance
3.35%
Type
Dynamic scaling

Paroli 3-step

Doubles after a win, banks the profit after 3 wins in a row, resets on any loss.

Chance
49.5%
Type
Paroli

Dynamic recovery

Sizes each bet so one win recovers the drawdown plus one base bet, capped at 10% of balance.

Chance
33%
Type
Recovery

D'Alembert

Adds one unit after a loss and removes one after a win, never going below the base bet.

Chance
49.5%
Type
D'Alembert

Labouchere

Bets the first plus the last number of a list. Wins cross numbers off, losses add one.

Chance
49.5%
Type
Labouchere

Oscar's Grind

Plays in cycles that aim for +1 unit: same bet after a loss, one unit more after a win.

Chance
49.5%
Type
Oscar's Grind

1-3-2-6

Bets 1, 3, 2 and 6 units on consecutive wins. Any loss, or the 4th win, resets to 1.

Chance
49.5%
Type
Positive progression

Flat betting

Same bet on every roll, with a stop loss and a take profit at 10% of the starting balance.

Chance
49.5%
Type
Flat betting

Martingale + vault

Martingale that moves half of every 1% profit step to the vault with vault().

Chance
49.5%
Type
Martingale