Equity curve simulator: what one backtest curve hides
A backtest gives one equity curve, which is one ordering of the trades. An equity curve simulator reshuffles or redraws those trades hundreds of times and shows the whole range of drawdowns and end values the same strategy could have produced, so you can set expectations from the median path and position size from the bad paths.
By Soren Huang · Published · updated · Editorial policy
Contents
- What does an equity curve simulator show that a backtest hides?
- Why is one equity curve only one sample?
- How do you simulate equity curves from win rate, payoff and trade count?
- How do you read the fan: median path, bad paths and time to recover?
- How do you use the simulated drawdown to set position size?
- Do equity-curve trading rules work, and what are their pitfalls?
- How do you run a simulation with your own numbers?
- Frequently asked questions
- References
What does an equity curve simulator show that a backtest hides?
An equity curve simulator shows the range of equity paths a strategy could have produced, not only the one path the backtest happened to produce. It reshuffles or redraws the strategy's trades hundreds of times, so you see the spread of drawdowns and end values, read a realistic median, and size positions from the bad paths instead of one line.
An equity curve is the running total of a strategy's closed-trade results, plotted in trade order or in time order. A backtest report draws one such curve and labels its deepest dip as the maximum drawdown. Maximum drawdown is the largest fall from an equity high to the next low before a new high is made, usually written as a percentage of the account or as an amount of money.
An equity curve simulator is a program that takes the trades, or the statistics of the trades, and builds many alternative curves from them. The usual method is a Monte Carlo simulation: trades are shuffled into a new random order, or new trades are drawn at random with the same win rate and payoff, and the result is one new curve. Repeat this a few hundred or a few thousand times and you get a fan of curves. The backtest curve sits somewhere inside that fan. The simulator tells you where.
The inputs come from the trade list. AlphaPrime (Valynox) shows them in its Performance Report, which lists each trade with the equity curve and drawdown of the backtest. Before you simulate anything, check that the strategy has a positive edge per trade with the free win rate and expectancy calculator; a simulator cannot turn a negative expectancy into a positive one, it only shows how a given expectancy plays out across many orderings.
Why is one equity curve only one sample?
The same set of trades in a different order ends at the same place when the contract count is fixed, but passes through very different drawdowns, so the maximum drawdown in a backtest report is one draw from a wide distribution, not a fixed property of the strategy.
Think of a deck of 200 cards. Each card is one trade and shows a win or a loss. Shuffle the deck and deal the cards one by one, adding the results as you go: that is your backtest curve. Shuffle again and deal again: the sum of the cards is the same, but the losses now come in different places. If five losing cards happen to sit together near the middle, the curve has a deep dip there. If they are spread out, the curve looks smooth. The strategy did not change. Only the order did.
If you trade a fixed number of contracts, the sum of the trades does not depend on their order, so every reshuffled curve ends at the same final value. The path to that value is what changes. The deepest dip of one reshuffle can be twice as deep as the deepest dip of another, with the same trades.
Hypothetical example
Take a list of 200 trades with 90 wins of 2R and 110 losses of 1R, where R is the money risked on one trade. In any order the list adds up to 70R. Shuffle the list five times and build five equity curves. In the figure below the five curves end at the same 70R, but their maximum drawdowns run from about 8R to about 22R; if 1R is 1% of the starting account, that is 8% to 22% of the account. The backtest report would have shown only one of those five numbers.
This is why a backtest that shows a 10% drawdown over ten years gives no promise about the next year. The next year is a new deal from the same deck, and the deck has plenty of orderings with a 20% dip in it.
How do you simulate equity curves from win rate, payoff and trade count?
Three inputs taken from the backtest or the trade log are enough to build a fan of paths: the win rate, the payoff ratio, and the number of trades per year.
- Win rate is the share of trades that closed with a profit, for example 45 out of 100.
- Payoff ratio is the average winning trade divided by the average losing trade. A payoff ratio of 2 means the average win is twice the size of the average loss.
- Trades per year sets how long one simulated path is. A strategy with 250 trades a year needs 250 draws to simulate one year.
Together, win rate and payoff ratio give the expectancy, which is the average result of one trade in units of risk. The only formula you need is:
Expectancy = (win rate × average win) − (loss rate × average loss)
Here the win rate is the share of winning trades, the loss rate is one minus the win rate, the average win is the mean profit of the winning trades and the average loss is the mean loss of the losing trades, both measured in R, the amount risked per trade. A positive expectancy means the strategy gains on average per trade; the simulator then shows how rough the road to that average can be.
The simulation itself is a loop of four steps:
- Set the three starting values, win rate, average win and average loss, and the number of trades per year.
- Draw one random sequence of that many trades. For each trade, pick a win with probability equal to the win rate, otherwise a loss.
- Add the results one after another to get one equity path.
- Repeat steps 2 and 3 a thousand times, then sort the paths by their end value and by their maximum drawdown so you can read the percentiles. A percentile is the level that a given share of the paths fall below: the 5th percentile is the value only 5 of every 100 paths fall under.
Hypothetical example
Win rate 45%, average win 2R, average loss 1R, 250 trades a year. Expectancy = 0.45 × 2R − 0.55 × 1R = 0.90R − 0.55R = 0.35R per trade. Over 250 trades the average path ends near 87R. Drawing a thousand paths with these inputs gives a median maximum drawdown of about 12R, a 5th-percentile maximum drawdown of about 24R, and a few paths deeper than 30R. The backtest that produced these statistics showed a single drawdown of 15R, close to the middle of the fan.
A simulation built from shuffled real trades keeps the actual size of each trade and so keeps the big outliers. A simulation built from win rate and payoff ratio alone assumes every win and every loss has the same size, which smooths the extremes. Use the shuffle method when you have the trade list; use the three-input method when you only have summary statistics. The free Monte Carlo simulator applies the shuffle method to a pasted trade list, so you can see the spread of drawdowns without building the fan by hand.
How do you read the fan: median path, bad paths and time to recover?
Three things are worth reading from the fan: the median path for expectation, the 5th-percentile path for survival, and the longest stretch without a new equity high for patience.
| What to read | What it is | What to do with it |
|---|---|---|
| Median path | The path in the middle: half the simulated paths end above it, half below | Set expectations for a normal year, instead of using the backtest curve |
| 5th-percentile path | The path that only 5 of every 100 simulated paths fall below | Take its maximum drawdown as the loss you must be able to sit through |
| Longest flat stretch | The longest run of trades, or months, between one equity high and the next on a typical path | Decide in advance how long you will keep trading without a new high |
The median path is the honest version of the backtest curve. If the backtest curve lies well above the median, the backtest was a lucky ordering. If it lies well below, the backtest was unlucky, which happens too.
The 5th-percentile path is the one that matters for position size. It is not the worst path in the fan, because the worst of a thousand random paths is itself a random extreme; the 5th percentile is a stable, repeatable measure of a bad year.
The longest flat stretch is the number most traders skip and most traders need. A strategy with 250 trades a year and a 45% win rate will routinely go several months without a new equity high, even when nothing is wrong. Knowing that number before you start keeps you from switching the strategy off at exactly the wrong time.
The fan inherits whatever is wrong with its inputs. If the backtest's win rate and payoff came from an overfitted search, the whole fan sits too high. Run the simulation on trades from walk-forward out-of-sample windows when you can, so the inputs come from data the tuning did not see.
How do you use the simulated drawdown to set position size?
Size contracts so that the bad-path drawdown, not the backtest drawdown, fits inside the share of the account you are willing to lose. This usually means fewer contracts than the single curve suggests.
The procedure has three steps:
- Decide the largest drawdown you will accept as a share of the account, for example one quarter.
- Take the maximum drawdown of the 5th-percentile path, in R per contract.
- Choose the contract count so that this drawdown, multiplied by the money value of R per contract and by the contract count, stays under your limit.
Hypothetical example
Account 100,000. Limit: 25% of the account, which is 25,000. One contract risks 500 per trade, so 1R = 500 per contract. The backtest drawdown is 15R, which is 7,500 per contract; three contracts give 22,500, under the limit. The 5th-percentile drawdown from the simulation is 24R, which is 12,000 per contract.
| Sizing basis | Contracts | Drawdown used | Loss at that drawdown | Share of account |
|---|---|---|---|---|
| Backtest drawdown (15R) | 3 | Backtest curve | 22,500 | 22.5% |
| Same 3 contracts on the 5th-percentile path | 3 | 24R | 36,000 | 36% |
| 5th-percentile drawdown (24R) | 2 | 24R | 24,000 | 24% |
Sizing from the backtest curve gives three contracts and a bad year that costs 36% of the account. Sizing from the 5th-percentile path gives two contracts and keeps the bad year at 24%.
The free position size calculator does the last step for a given account risk and stop distance.
Do equity-curve trading rules work, and what are their pitfalls?
Equity-curve trading rules add a lagging parameter that often skips the recovery after a drawdown, so they must be tested on out-of-sample data like any other rule rather than assumed to help.
An equity-curve trading rule is a rule that switches a strategy off or on based on the shape of its own equity curve. The common form is: pause trading when equity falls below a moving average of equity, and resume when equity rises back above it. The idea sounds safe. In practice three problems appear.
- It reacts late. A moving average of equity falls only after several losing trades. By the time the rule pauses the strategy, most of the drawdown has already been taken.
- It resumes late. The average rises only after several winning trades, which the paused account does not take. The filtered curve therefore misses the first part of the recovery, which is often the strongest part.
- It adds a parameter. The length of the moving average is a new number to choose, and you choose it after seeing the backtest curve. A rule chosen this way is a form of selection on the same data, which is the mechanism that inflates backtests in the first place (Bailey, Borwein, López de Prado & Zhu, 2014).
The simulator gives you a clean test for such a rule. In a fan built from shuffled trades, the order is random, so the past few trades carry no information about the next one, and the rule cannot improve the result by construction. The rule can only help if your strategy's wins and losses cluster in a way that persists, for example because the market alternates between regimes that suit the strategy and regimes that do not. So compare two things: the rule applied to the real trade sequence, and the rule applied to a thousand shuffled sequences. If the real sequence does not do clearly better than the shuffled ones, the clustering is not there and the rule is only cost.
How do you run a simulation with your own numbers?
Take win rate, average win and average loss from your own trade list, check the expectancy, run the draws in a spreadsheet or any simulator, and compare the simulated drawdown range with the drawdown in your backtest report before you trade.
- Export the trade list. You need one row per closed trade with its profit or loss. From it, count the winning trades, compute the win rate, and compute the average win and the average loss in money or in R.
- Check the expectancy. Enter the three numbers in the win rate and expectancy calculator linked at the start of this article. If the expectancy after commission and slippage is not clearly positive, stop here; the fan of a zero-expectancy strategy is centred on zero and only tells you how large the random swings are.
- Run the draws. A spreadsheet is enough. One column of random numbers decides win or loss for each trade; a second column adds the results into a path; copying the columns sideways gives you many paths. The step-by-step sheet is in Monte Carlo simulation in Excel. If you have the trade list, shuffle it instead of drawing from win rate and payoff, so that large outliers stay in.
- Read three numbers. For each path, record the end value and the maximum drawdown; the free drawdown calculator finds the maximum drawdown and recovery time of any single equity series. Sort the paths and read the median end value, the 5th-percentile maximum drawdown and the typical longest flat stretch.
- Compare with the report. Put the backtest drawdown next to the simulated range. If the backtest drawdown sits near the shallow edge of the fan, the backtest was a kind ordering and the live strategy will feel rougher. Size from the 5th-percentile drawdown as in the section above.
- Repeat after changes. Any change to the rules, the costs or the market changes the trade statistics, so rerun the simulation and re-size when the inputs change.
What this means if you use AlphaPrime: the Performance Report gives you the backtest equity curve, its drawdown and the full list of trades, which are the inputs the simulation needs; the simulation itself runs in your spreadsheet or simulator and tells you how wide the band around that one curve is before you choose a contract count.
Frequently asked questions
What is an equity curve simulator?
An equity curve simulator is a program that builds many alternative equity curves from a strategy's trades or trade statistics. It shuffles the trades into new orders, or draws new trades with the same win rate and payoff, and plots the result as a fan of paths. The fan shows the range of drawdowns and end values the strategy could have produced, while a backtest shows only one path.
How many simulated paths do I need?
A few hundred paths show the shape of the fan; about a thousand give stable percentiles such as the 5th-percentile drawdown. Beyond that the percentiles change very little. The number of trades per path matters more: it should match the number of trades the strategy makes in the period you want to plan for, for example one year.
Why does the simulated drawdown differ from the backtest drawdown?
The backtest drawdown comes from one particular order of the trades. The same trades in another order can produce a much shallower or much deeper drawdown while ending at the same value. The simulation shows the whole range, so the backtest number usually sits somewhere inside it, and often not in the middle.
Should I use the median drawdown or the 5th-percentile drawdown to size positions?
Use the 5th-percentile drawdown for sizing, because that is the drawdown you need to survive in a bad year, and use the median path for expectations. Sizing from the median means that about half of all years will be worse than you planned for. Sizing from the single worst path in the fan is unstable, because that path changes every time you rerun the simulation.
Does pausing a strategy when its equity curve falls improve results?
Not by default. A moving average of equity reacts after the drawdown has already happened and switches the strategy back on after the recovery has already begun, so the filtered curve often ends lower. The rule only helps if the strategy's wins and losses cluster in a way that persists, and that has to be shown on out-of-sample data, not assumed.
References
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.

