It would be very interesting to see what sort of simulation you are running.
Here's a very simple simulation of martingale betting vs. flat betting:
#!/usr/bin/env python
import random
edge = 2.0 # what's the house edge?
lessthan = (1 - edge/100) / 2 # what does that represent as a 'lessthan' target (between 0 and 1)
def play(stake):
if random.random() < lessthan: return stake
return -stake
repeats = 10
plays = 1000000
min_bet = 1
max_bet = 1000
# flat betting
stake = min_bet
for repeat in range(repeats):
balance = 0
total_bet = 0
for n in range(plays):
total_bet += stake
balance += play(stake)
print "after %d flat plays, bet %7d, profit %7d. won %7.4f per unit bet" % (plays, total_bet, balance, float(balance)/total_bet)
print
# martingale
for repeat in range(repeats):
balance = 0
n = 0
stake = min_bet
total_bet = 0
while n < plays:
total_bet += stake
profit = play(stake)
balance += profit
if profit > 0:
stake = min_bet
else:
stake *= 2
if stake > max_bet:
stake = min_bet
n += 1
print "after %d martingale plays, bet %7d, profit %7d. won %7.4f per unit bet" % (plays, total_bet, balance, float(balance)/total_bet)
and here's some sample output:
$ python ~/Source/Python/martingale-house-edge.py
after 1000000 flat plays, bet 1000000, profit -20838. won -0.0208 per unit bet
after 1000000 flat plays, bet 1000000, profit -21044. won -0.0210 per unit bet
after 1000000 flat plays, bet 1000000, profit -19336. won -0.0193 per unit bet
after 1000000 flat plays, bet 1000000, profit -19268. won -0.0193 per unit bet
after 1000000 flat plays, bet 1000000, profit -20994. won -0.0210 per unit bet
after 1000000 flat plays, bet 1000000, profit -19716. won -0.0197 per unit bet
after 1000000 flat plays, bet 1000000, profit -20520. won -0.0205 per unit bet
after 1000000 flat plays, bet 1000000, profit -19954. won -0.0200 per unit bet
after 1000000 flat plays, bet 1000000, profit -20046. won -0.0200 per unit bet
after 1000000 flat plays, bet 1000000, profit -18202. won -0.0182 per unit bet
after 1000000 martingale plays, bet 5330214, profit -77550. won -0.0145 per unit bet
after 1000000 martingale plays, bet 5338031, profit -96823. won -0.0181 per unit bet
after 1000000 martingale plays, bet 5347483, profit -123551. won -0.0231 per unit bet
after 1000000 martingale plays, bet 5370050, profit -86658. won -0.0161 per unit bet
after 1000000 martingale plays, bet 5387133, profit -114297. won -0.0212 per unit bet
after 1000000 martingale plays, bet 5400165, profit -96079. won -0.0178 per unit bet
after 1000000 martingale plays, bet 5412402, profit -131294. won -0.0243 per unit bet
after 1000000 martingale plays, bet 5394777, profit -136873. won -0.0254 per unit bet
after 1000000 martingale plays, bet 5387980, profit -110224. won -0.0205 per unit bet
after 1000000 martingale plays, bet 5335811, profit -100759. won -0.0189 per unit bet
Notice that the flat betting has numbers much closer to 0.02 due to the lesser variance, but both the flat betting and the martingale betting give house edge numbers with a mean of 0.02. If we were to run for more than a million plays each, the numbers would get ever closer to 0.02.