{adamcoding}
Part I
04
Chapter 4

Expectancy - The Only Equation That Matters

If you internalise one chapter, this is the one. Everything about strategy selection reduces to it.

R: the unit of account

Define R as the amount you risk on a trade - the distance from entry to stop, multiplied by position size. If you risk €200 on every trade, then 1R = €200, and every outcome can be stated in R:

  • Stopped out: −1R
  • Hit a target twice your stop distance: +2R
  • Exited early at half your stop distance in profit: +0.5R

This normalisation is the key move. It makes trades comparable across instruments, account sizes, and time. It's the reason the script in the appendix sizes positions by risk rather than by fixed quantity: without it, your results are contaminated by position-size variation and you cannot measure what you're trying to measure.

The equation

E = (P_{win} times overline{W}) - (P_{loss} times overline{L})

Where wins and losses are expressed in R. That's it. That is the whole thing.

Positive E means you have a business. Negative E means you have a hobby that costs money. Everything else - indicators, timeframes, entry timing - matters only insofar as it moves E.

A worked example. Your EMA crossover system, 200 trades:

  • 76 wins averaging +1.5R
  • 124 losses averaging −1.0R
E = (0.38 times 1.5) - (0.62 times 1.0) = 0.57 - 0.62 = -0.05R

A 38% win rate with a 1.5:1 reward ratio loses 0.05R per trade. Over 200 trades at €200 risk, that's −€2,000, and you'd have felt like you were nearly breaking even the whole way.

Win rate is a vanity metric

The breakeven win rate for a given reward:risk ratio R is simply:

P_{breakeven} = frac{1}{1 + R}
Reward:RiskBreakeven win rate
0.5 : 166.7%
1 : 150.0%
1.5 : 140.0%
2 : 133.3%
3 : 125.0%
5 : 116.7%

Read this table until it's automatic, because it kills a whole category of bad reasoning. A 70% win rate sounds excellent and is a losing system if your reward:risk is 0.4. A 25% win rate sounds terrible and is profitable at 4:1. Trend-following systems typically win 30-40% of the time and make money from a small number of large winners; the psychological difficulty of that is a real cost, and it's why the edge persists.

Widening your target always lowers your win rate. There's no configuration that improves both. The only question that matters is whether it lowers win rate by less than the maths requires - that gap is the edge.

Variance, or: positive expectancy still hurts

Here's what engineers consistently underestimate. Take a genuinely good system: 45% win rate, 2:1 reward:risk, E = +0.35R per trade. Excellent by any standard.

The probability of losing 8 trades in a row is 0.55⁸ ≈ 0.84%. Sounds rare. But over 500 trades, you get roughly 500 opportunities for such a run to start, and the expected number of 8-loss streaks is well above one. You will experience it. It is not a signal that anything broke.

Simulate this before you trade, not after:

python
import numpy as np

def simulate(n_trades=500, win_rate=0.45, win_r=2.0, loss_r=-1.0, n_runs=10_000):
    wins = np.random.random((n_runs, n_trades)) < win_rate
    results = np.where(wins, win_r, loss_r)
    equity = np.cumsum(results, axis=1)

    running_max = np.maximum.accumulate(equity, axis=1)
    drawdowns = running_max - equity
    max_dd = drawdowns.max(axis=1)

    final = equity[:, -1]
    return {
        "median_final_R": np.median(final),
        "p05_final_R": np.percentile(final, 5),
        "prob_negative": (final < 0).mean(),
        "median_max_dd_R": np.median(max_dd),
        "p95_max_dd_R": np.percentile(max_dd, 95),
    }

print(simulate())

Run it. The median maximum drawdown for a positive-expectancy system is typically in the region of 10-20R, and the 95th percentile is far worse. If you're risking 2% per trade, a 15R drawdown is a 30% account decline - from a system that works exactly as designed.

Decide in advance what drawdown you'll tolerate, and derive your position size from that, rather than discovering your tolerance empirically in the middle of one.

The sample size problem

This is the point that should reframe how you read every backtest, and it's the most engineer-legible argument in the book.

You want to know whether your true expectancy is positive. You observe a sample mean. The standard error of that mean is σ/√N, where σ is the per-trade standard deviation in R - typically around 1 to 1.5 for a system with fixed stops.

To conclude that your edge is real at roughly the conventional threshold, you need:

frac{E}{sigma/sqrt{N}} > 2 quad Rightarrow quad N > left(frac{2sigma}{E}right)^2

With σ = 1.0:

True edge ETrades needed
+0.5R16
+0.3R45
+0.2R100
+0.1R400
+0.05R1,600
+0.02R10,000

Now hold that against reality. Real edges are usually small - +0.05R to +0.15R is a genuinely good systematic strategy. Which means you need somewhere between 200 and 1,600 trades to distinguish it from zero.

Two conclusions follow, and both are uncomfortable:

Your backtest with 80 trades has told you nothing. Not "a little" - the confidence interval spans zero comfortably in both directions.

And when you then optimised across 50 parameter sets on those 80 trades, you didn't just learn nothing; you actively selected for noise. The best-of-50 result on an 80-trade sample will look great and mean nothing. This is Chapter 8, and this table is why it matters.

Kelly, and why you won't use it

The Kelly criterion gives the position size that maximises long-run geometric growth. For a simple win/loss system:

f^* = P_{win} - frac{P_{loss}}{R}

For our example (45%, 2:1): f* = 0.45 − 0.55/2 = 0.175. Risk 17.5% of capital per trade.

Do not do this. Two reasons, and the second is the important one:

Kelly is brutal even when correct. Full Kelly produces drawdowns exceeding 50% with near-certainty over enough trades. It maximises growth, not survivability, and it assumes you can keep trading through anything.

Kelly assumes you know your true edge. You don't. You have a noisy estimate from a limited sample - see the table above. Overestimating your edge causes Kelly to overbet, and overbetting is not symmetric with underbetting: it can drive your expected growth negative even with a positive-expectancy system.

Standard practice is fractional Kelly, typically a quarter or less, which retains most of the growth with far less of the pain. In practice, most systematic retail traders use fixed fractional risk of 0.5-2% per trade, which is usually well below quarter-Kelly and is the right answer given how uncertain your edge estimate is.

The general principle: your position size should reflect your uncertainty about your edge, not just the size of your estimated edge. Small sample, small size.