LuxAlgo
Strategies

Simulation

Replay your backtest's trades to explore different outcomes and drawdowns.

View as Markdown

Open the Backtest viewer, then choose Simulation. Simulation replays the backtest's closed trades many times to explore how results change when trades repeat or arrive in a different order. Each replay is one run, or trial.

It helps answer questions such as: “How much worse could the drawdown look with a different sequence?” and “How often do these replays finish profitable?”

Simulation uses closed-trade P&L before commission, as noted below the simulation results, even where charts use the label “net profit.” It replays observed trades to explore repeatability and sequencing risk. It does not generate new market regimes or establish what will happen in live trading.

Screenshots show an example BTCUSD backtest. Results vary with the trade history and settings. Select an image to view it at full size.

Resample or Shuffle

Simulation method selector with Resample selected and Shuffle available

Choose whether to sample trades with repeats or reorder the same trades.
MethodWhat happensWhat you learn
ResampleRandomly selects existing trade results with replacement: a trade can appear more than once, while another may not appear.How outcomes vary when the observed mix of trades changes.
ShuffleReorders the same trades.How trade order affects the path, drawdowns, and streaks.

For example, start with three trades: +$100, −$50, +$200. A resample could select +$100, +$100, −$50, ending at +$150. A shuffle could produce −$50, +$200, +$100, still ending at +$250.

With Random P&L variation set to zero, every Shuffle run has the same ending total. The journey to that total can still differ substantially. With variation enabled, trade amounts can change, so do not assume identical ending totals.

Settings

Simulation settings showing 1,000 trials, zero random P&L variation, and disabled Preserve win/loss

At zero variation, trade amounts stay unchanged and Preserve win/loss is disabled.

Simulations is the number of trials to run. For example, 1,000 means 1,000 replays of the trade history, not 1,000 trades. Increasing it to 2,500 generally makes estimates less sensitive to random sampling, but does not fix assumptions or add evidence about unseen market conditions.

Random P&L variation changes a trade's outcome each time it occurs in a replay. Zero leaves its original amount unchanged. The tooltip describes approximate variation; it does not specify a precise probability distribution or hard upper and lower bounds. Do not read the setting as a guaranteed ±percentage range, or as a specific model of slippage or fills.

Preserve win/loss is intended to retain whether a trade is a winner or loser when variation is applied. It does not lock the trade's amount. The setting's label does not specify how zero outcomes or other edge cases are handled.

Drawdown and thresholds

A drawdown is a decline from an equity peak to a later low. If equity rises to $12,000, falls to $9,000, then recovers, that decline is $3,000. It is not the run's ending loss.

Actual max drawdown is the largest peak-to-trough decline in the original backtest trade sequence. “Actual” refers to the original backtest, not live trading. Simulation works from closed trades, so its drawdown can differ from the Performance tab's bar-by-bar calculation. The before-commission basis also matters when comparing results; do not assume the tabs use interchangeable figures.

USD and percentage units

Maximum drawdown histogram with its axis labeled percent of peak equity

Percentage mode measures drawdown relative to peak equity.

USD expresses the decline as a dollar amount. The percentage drawdown axis is labeled Max drawdown (% of peak equity): the decline is measured relative to the relevant equity peak, not simply starting capital.

In the $12,000-to-$9,000 example, drawdown is $3,000, or 25% of the $12,000 peak. Keep the selected unit in mind when reading thresholds and distributions.

1.5× DD, 2× DD, 3× DD, and custom values

Drawdown threshold controls with 2 times DD selected, custom multiplier 2, and USD units

The multiplier selects a threshold; USD and % select the drawdown display unit.

These controls choose a threshold relative to the original maximum drawdown. If the original drawdown is $1,000, 1.5× DD sets a $1,500 threshold, 2× DD sets $2,000, and a custom multiplier of 3.1 sets $3,100.

The multiplier changes the level being measured. It does not change position sizing or multiply trade losses.

P(drawdown ≥ threshold) is the share of simulated runs whose maximum drawdown reaches or exceeds that level. If 200 of 1,000 runs reach a $2,000 threshold, the reported probability is 20%.

When using percentage units, two percentages can appear: one describes the drawdown threshold, and the other the share of runs crossing it. A 4% drawdown threshold with a 20% probability means one fifth of runs reached at least that drawdown; it does not mean the threshold is 20%.

Summary metrics

Simulation summary showing profit probability, median outcome, drawdown percentiles, ruin probability, threshold exceedance, losing streak, and actual drawdown

Example Resample results. The drawdown threshold and its probability are different quantities.
MetricHow to read it
Probability of profitShare of whole runs ending above zero. If 600 of 1,000 runs finish positive, this is 60%. It is not the percentage of individual winning trades.
Final net profit (every run)The common ending P&L in Shuffle when variation is zero. Different paths can still lead to this same total. Remember the before-commission basis.
Median outcomeThe middle ending P&L when runs are ordered from lowest to highest. Roughly half finish below it and half above it.
Risk of ruinShare of runs losing all starting capital, as defined by the page tooltip. This is separate from crossing your chosen drawdown threshold. A reported zero does not prove there is no real-world risk.
P95 / P99 drawdownThe 95th / 99th percentile of runs' maximum drawdowns. Roughly 95% / 99% are at or below that value; the remaining tail can be worse. These are not guaranteed limits.
P95 losing streakThe 95th percentile of each run's longest consecutive losing streak. A value of 8 means roughly 95% of runs have a longest losing streak of 8 trades or fewer.

Read the charts

Simulated Net Profit Paths

Actual backtest line, median simulation line, and shaded 25–75% and 5–95% bands

The actual path is shown in green; shaded bands show the spread of simulated values.

The actual line follows the original backtest sequence. The median line shows the middle simulated result at each point in the replay.

The 25–75% band contains the middle half of simulated values at each point; the wider 5–95% band contains the middle 90%. These are point-by-point ranges, not a promise that a particular run stays inside a band for its entire path. The median line need not represent one individual run.

Outcome Distribution

Ending P&L histogram with red loss buckets, green profit buckets, and the original result marked

Histogram: each bar counts runs ending in that P&L range.

The histogram groups runs by their ending P&L. A bar over the $0–$500 bucket shows how many runs finished in that range.

The cumulative view shows the share of runs ending at or below a given amount. For example, 70% at $500 means 70% ended at $500 or less, including any losing runs.

Cumulative ending P&L distribution rising from zero to 100 percent

Cumulative: read the share of runs at or below any ending P&L amount.

Max Drawdown Distribution

Maximum drawdown histogram in USD, with the actual drawdown and percentile markers

Each run contributes its worst decline, even if that run finishes profitable.

This groups each run by its worst peak-to-trough decline, not its ending loss. A run can finish profitable and still contribute a large drawdown to this chart.

Switch to Cumulative to read the share of runs whose maximum drawdown is at or below a given amount. For example, 90% at $10,000 means 90% of runs had a maximum drawdown of $10,000 or less. The summary probability P(drawdown ≥ threshold) instead measures runs that reach or exceed the selected threshold.

Check whether the axis is in USD or percentage units before comparing the distribution with a selected threshold.

Streaks & Recovery

Streaks and Recovery table comparing actual, median, and P95 losing streak and drawdown durations

Durations are counted in trades.

Longest losing streak counts the greatest number of consecutive losing trades in a run.

Max DD duration counts trades from the equity peak before the deepest drawdown to its trough. Recovery counts trades from that trough back to the prior peak. For example, if the peak occurs after trade 10, the trough after trade 15, and the prior peak is regained after trade 23, the decline takes 5 trades and recovery takes 8.

On this page