In Level 4 you saw how reshuffling a list of trades shows the drawdowns the same trades could have given you. By the end of this lesson, you'll do it ten thousand times in code, and read the range it gives. You'll also know what shuffling can and can't tell you.
1 of 9
What you'll learn
- Shuffle the trade order. The total stays the same, but the drawdown changes.
- Run thousands of shuffles. Set a seed so you get the same shuffles each time.
- Read the range. Look at the 5%, middle and 95% drawdowns, and see where yours sits.
- Put it in dollars. Multiply each drawdown by your own 1R.
- Check what it assumes. Shuffling treats trades as separate and can't add new ones.
Exercise
- Shuffle the A trade’s result after commissions and fees are taken off.More in the glossary R column of your own test 10,000 times.
- Find the 5%, 50% and 95% drawdowns, and see where your real order sits.
- Turn the 5% figure into dollars with your own 1R.
Quick check
1. You shuffle a trade list. What stays the same in every order?
2. Why pass a number like 42 to default_rng?
3. Losses in your strategy tend to cluster in one kind of market. What can shuffling do?
0 of 3 answered.
Finished this lesson?
Tick it off and keep your place
Read the full notes
Shuffling the same trades thousands of times in code keeps the total but changes the A fall in an account’s balance from a high point. On a funded account, it also names the loss limit the balance has to stay above.More in the glossary, so you see the range of paths those trades could have taken. It assumes trades don't depend on each other.
- Shuffling the order of the same trades leaves the total unchanged but changes the A fall in an account’s balance from a high point. On a funded account, it also names the loss limit the balance has to stay above.More in the glossary and losing runs (Shuffling trade order). Doing it thousands of times is a Rebuilding a list of trade results many times, in a random order or by drawing trades at random, to see how different the path could have looked.More in the glossary.
- Code: load the trades with pd.read_csv; rng = np.random.default_rng(42) (the 42 makes the shuffles repeat); in a loop of 10_000, rng.permutation(r.values) makes a shuffled copy, and max_drawdown stores its deepest drawdown; pd.Series(worst).quantile([0.05, 0.5, 0.95]) reads the range.
- Made-up list: 36 trades, total −3R. Real order −13R. Shuffled: 5% point −14R (at least one order in twenty that deep or deeper), middle −9R, 95% at least −6R, worst −21R.
- In dollars, with a made-up 1R of $200: middle $1,800; 5% point $2,800; worst $4,200.
- Limits: it assumes trades don't depend on each other; it can't add trades that never happened; it describes these trades, not future ones; a small list stays small (Sample size). More: Monte Carlo simulation.
Worked example
Made-up numbersPutting the range into dollars
Made-up numbers · 1R = $200 · middle −9R · 5% point −14R · worst −21R
- Middle order: 9 × $200 = $1,800 drawdown
- 5% point: 14 × $200 = $2,800
- Worst of 10,000: 21 × $200 = $4,200
- Same 36 trades, same total, different order.
The range shows what the same trades could have put you through.
Your turn
DrillMade-up numbers · 1R = $250 · 5% point of the shuffled drawdowns: −12R
Trading is risky. You can lose money. Test results are hypothetical, and a test can't tell you what will happen next. This lesson explains how testing works. It isn't advice.