Reshuffle your own trade results to see the drawdowns your rules could produce

A script resamples your closed-trade R-multiples thousands of times to show the range of losing streaks and drawdowns your past results allow. It describes your sample rather than forecasting, and helps you set drawdown rules calmly.

How it works

  1. Export from your journal the R-multiple of every closed trade taken under your current rules. Trades from older rule versions go in a separate file.
  2. A script draws random sequences of the same length from those results, with replacement, many thousands of times, applies your normal risk per trade, and records each sequence's longest losing streak and deepest drawdown in R and in percent.
  3. It reports the median and a bad-but-plausible case, the 95th percentile of maximum drawdown and of longest losing streak (larger is worse for both), next to what your actual sequence showed.
  4. It states the sample size first and refuses to run below a minimum you set, because a few dozen trades say very little.
  5. You compare the bad case with the drawdown thresholds in your rules. If your rules would trip on an ordinary bad run, or never trip at all, write that down as a question for your next rule review rather than changing anything on the spot.
  6. Rerun it monthly as trades are added, and keep each month's figures so you can see how stable they are.

Copy-paste prompt

Write a Python script that resamples my own closed-trade results. It gives no trading advice, never suggests trades or securities, and makes no forecast.
Inputs: {{r_multiples_csv}} (one R value per closed trade under my current rules), my risk per trade {{risk_pct}}, the number of simulations {{n_sims}} and the minimum sample {{min_trades}}.
The script must:
1. Stop with a message if there are fewer than {{min_trades}} trades.
2. Draw {{n_sims}} sequences the same length as my sample, with replacement and a fixed random seed so results can be repeated, compounding equity at {{risk_pct}} per trade.
3. For each sequence, record the longest losing streak and the maximum drawdown in R and in percent.
4. Report the median, the 95th percentile (bad case) and the 5th percentile (mild case) of both, alongside the values from my actual sequence. Larger values are worse for both measures.
5. Print this caution line: "These figures describe resampled past results and assume trades are independent; they are not a forecast."
Include a test with a small sample I can check by hand.

Guardrails

  • The input is your own closed trades under one set of rules, with no market data, no scans and no new trades.
  • The output is labelled as resampled history, not a forecast.
  • Below your minimum sample size the script refuses to run.
  • Any change to your drawdown rules goes through your written rule review, not straight from the output.
  • No broker access and no orders.

What can go wrong

Resampling assumes trades are independent, but real losing streaks tend to cluster when market conditions change, so the bad case is usually milder than reality. It also can't show a loss bigger than the worst one already in your sample. A small or lucky sample makes the whole range look comfortable, which is why the minimum sample matters more than the number of simulations. Treat the result as a lower bound on how rough things can get.

Why it helps

Your actual trade history is one sequence out of many that the same results could have produced. Reshuffling it shows how long a losing streak and how deep a drawdown are ordinary for your own numbers, which is exactly what you need when setting drawdown rules and deciding how worried to be in a bad month. Because it uses only your own closed trades, it says nothing about any market or security and suggests no trades.

How it fits with other entries

The drawdown mode check (aft-0038) acts on drawdown thresholds, and this entry helps you set those thresholds sensibly. The weekly stats (aft-0007) provide the R values, the sizing check (aft-0008) uses the same risk per trade, and the trial log (aft-0041) is the right place to record it if you resample several rule versions.

Where this comes from

An original write-up by Agents for Traders, based on the standard statistical bootstrap and Monte Carlo resampling described in the public references below.

Source and references

Original write-up by Agents for Traders. Background reading is linked below.

Spotted an error, or want your post removed? Email hello@agentsfortraders.com.

Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.

Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.

Related use cases