I think people are confusing a "true" martingale sequence with a realistic one. A true martingale betting sequence has no limits on either profit or bankroll. Or maybe "expected value" is confusing.
Ignoring the house edge, the expected profit value of a "true" martingale sequence is always a*(1 - p)/p where p = probability of winning and a = the starting amount. It's what
defines a martingale sequence.
Edit: I originally had an error in the next section, but
dooglus showed me the error of my way. What follows is updated, corrected, and AFAICT correct.
When a bound is set the result is different. For example, if a bettor plays a 50% chance to win game and starts with a = 1 and stops betting after the n = 9th loss in a row, the total expected profit is the expected profit from up to 8 losses (and then a win) + the expected profit of greater than 8 losses in a row:
E(profit) = Pr(losses in a row <= 8 )*(1 - p)/p - Pr(losses in a row > 8)* sum(2^0+2^1+...+2^8)
= (1-(1 - 0.5)^9) - (1 - 0.5)^9 * 511
= (1-1/512 - 1/512 * 511)
= 0
So in this particular case, the expected profit is -1, (even before the house edge is taken into account).
This result can be generalised as you would expect. The geometric CDF for losses in a row = 0, 1, 2, ... n is:
Lower tail = Pr(losses in a row <= n): (1 - (1 - p)^(n+1))
Upper tail = Pr(losses in a row > n): (1 - p)^(n+1)
Using the above and the
definition of a martingale sequence, the expected profit of a "realistic" martingale sequence (still ignoring the house edge), where a bettor stops betting after n losses in a row is:
E(profit for losses in a row <= n): (1 - (1 - p)^(n+1)) * a * (1 - p) / p
E(profit for losses in a row > n): -(1 - p)^(n + 1) * a*(((1 - p)^(-n) - 1)/p + 1)
E(profit) = (1 - (1 - p)^(n+1)) * a * (1 - p) / p -(1 - p)^(n + 1) * a*(((1 - p)^(-n) - 1)/p + 1)
= 0
The interesting thing here is that no matter the largest number of losses in a row you can manage, the
expected profit for a bounded martingale sequence will always be 0. This means that unless both you and the casino have an infinite bankroll and bets are unlimited, your expected profit will always be 0, even at a casino with no house edge.
tl;dr:
1. The expected profit of a martingale sequence is a*(1 - p)/p
2. The expected profit of a bounded martingale sequence is 0.