Skip to content
Wildflower
Join free
Risk management in depth

Free Trading School · Level 5 · Course 5.1

Using a simulation to see ruin

Lesson 5 of 15 in Risk management in depthModule 1: The maths of losing

The trader · Risk management in depth

Using a simulation to see ruin

Wildflower Trading School · Lesson 5.1.1.5

Wildflower

Last time, you met the risk of ruin, and a sum for the simplest case. The sum assumed trading forever, with wins and losses the same size. This lesson builds something more flexible. By the end, you'll be able to build a simple simulation in a spreadsheet. It makes up 100 trades at random from a win rate and a payoff, and reports whether the balance reached your line. You'll run it at two sizes, and see how the answer changes.

1 of 10

What you'll learn

  • Build a simple sheet. Make up random trades from your rules and track the balance.
  • Flag runs that reach your line. Find the lowest balance and mark Yes or No.
  • Run it 20 times. Recalculate the sheet and count how many runs say Yes.
  • Change the size and repeat. See how a bigger size changes the count.
  • Read small samples with care. Twenty runs is few, and your win rate is a guess.

Exercise

  1. Build the sheet yourself, with your practice account's start and line, and your practice size in G1.
  2. Do 20 runs and tally the Yes answers.
  3. Then double G1 and do 20 more.
  4. Then try a slightly weaker edge, such as 0.35 in column C, and see how the tally moves.

Quick check

  1. 1. What does =IF(B2<0.4,2,-1) do?

  2. 2. Why use MIN on the balance column?

  3. 3. Seven of 20 runs reached the line. What is the fairest reading?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “Daily loss limits” is waiting next time.

Read the full notes

A simple spreadsheet simulation makes up trades at random from a win rate and payoff, tracks the balance, and reports whether it reached the trader's line; running it many times at different sizes shows how size changes the chance of surviving a bad run.

  1. Settings in column G: G1 is in dollars, G2 the start, G3 the line. Made-up: 200, 5,000 and 4,000.
  2. B2: =RAND(), copied down to B101. C2: =IF(B2<0.4,2,-1), copied down. Made-up rules: about 4 trades in 10 win +2R, the rest lose 1R.
  3. D2: =$G$2+C2*$G$1. D3: =D2+C3*$G$1, copied down to D101. That's the balance after each trade.
  4. G5: =MIN(D2:D101), the lowest balance. G6: =IF(G5<=G3,"Yes","No"), whether the run reached the line.
  5. Recalculate (in Google Sheets, edit any empty cell; in Excel, press F9) and tally the Yes answers over 20 runs. Then change G1 and repeat.
  • Made-up result: at $200 a trade (5R of room), 7 of 20 runs reached the line. At $50 (20R), none did. Run 100,000 times by computer: about 36 in 100, and about 1 in 100.
  • Twenty runs is a small sample, and the win rate and payoff are guesses. A slightly weaker edge raises the count a lot. Online calculators run the same loop many times. To use your own trades, see Shuffling trade order and Monte Carlo simulation.

Worked example

Made-up numbers

The first seven trades of one run

Made-up numbers · start $5,000 · 1R = $200

  1. Results: −1, +2, −1, −1, +2, −1, −1 (in R)
  2. Balance: $4,800, $5,200, $5,000, $4,800, $5,200, $5,000, $4,800
  3. The run carries on to 100 trades; MIN finds the lowest point

In this made-up run, the lowest balance was $3,800, so it reached the $4,000 line.

Your turn

Drill

Made-up numbers · start $5,000 · 1R = $200 · win +2R, loss −1R · trades: loss, win, loss, loss

Trading is risky. A stop isn't guaranteed, so you can lose more than you planned. All numbers here are made up. This lesson explains how traders work out their own rules. It isn't advice.