Choose the randomization before choosing a tool
A simulation is only interpretable when its random input is explicit. SciPy describes bootstrap resampling as drawing with replacement from the original sample. A shuffled sequence instead uses every observation once. Changes to execution costs, strategy parameters or market regimes require additional assumptions and a different experiment.
| Method | What changes | What stays fixed | Question it answers |
|---|
| Permutation / shuffling | Order of existing trades | Trade count and each cash P&L; therefore total P&L | How much can the path deteriorate when the same losses cluster? |
| Independent bootstrap | Order and frequency of sampled trades; repeats and omissions occur | Empirical set of possible single-trade outcomes and chosen horizon | How do outcomes vary if trades are independent draws from this sample? |
| Block bootstrap | Sequence of groups of consecutive observations | Some local dependence within each sampled block | How sensitive is the result when nearby losses stay together? |
| Parametric or execution stress model | Draws from specified distributions, or reruns with changed assumptions | Only the assumptions explicitly held constant | What happens under this particular volatility, cost or parameter scenario? |
Four trades: identical ending equity, different drawdowns
This illustrative calculation starts with $1,000 and uses fixed cash P&L after assumed costs: +$200, -$100, +$200, -$100. Equity equals initial capital plus cumulative P&L. Percentage drawdown at each step is (running peak minus equity) / running peak. There are no deposits, withdrawals, resizing or trading halts.
- Every permutation ends at $1,200 because addition is order-independent. A shuffle cannot turn this fixed cash trade list into a negative total return.
- The bootstrap row repeats a loss and omits wins. Its total P&L changes because the sampled trade mix changes.
- Reordering fixed percentage returns also preserves their compounded product when all trades execute. Capital limits, resizing rules and early stopping can break that equivalence.
- These are arithmetic examples, not measured strategy results. Closed-trade paths do not reconstruct losses inside an open trade.
| Sequence | Equity after each trade | Final equity | Maximum drawdown |
|---|
| Original: +200, -100, +200, -100 | $1,200, $1,100, $1,300, $1,200 | $1,200 (+20%) | $100; 8.33% |
| Shuffle: +200, +200, -100, -100 | $1,200, $1,400, $1,300, $1,200 | $1,200 (+20%) | $200; 14.29% |
| Bootstrap draw: -100, -100, -100, +200 | $900, $800, $700, $900 | $900 (-10%) | $300; 30% |
A small exact distribution you can check
In the four-trade sample, an independent draw has a 1/2 chance of +$200 and a 1/2 chance of -$100. With four draws and W wins, final equity is $600 + $300 × W. The table enumerates all 16 equally likely win/loss sequences, so it has no Monte Carlo sampling error. Its probabilities belong to this deliberately small model.
- The model probability of ending below $1,000 is 5/16 = 31.25%. It is not an estimate backed by a representative trading history.
- Using the inverse empirical CDF convention, the 5th-percentile final equity is $600: the first value whose cumulative probability reaches 5%. Other percentile conventions may interpolate.
- Ending balance is not path survival. From $100, the sequence -$150 then +$200 ends at $150 but touches -$50 first. A real account could be unable to take the second trade.
| Wins in four draws | Final equity | Number of sequences | Model probability |
|---|
| 0 | $600 | 1 of 16 | 6.25% |
| 1 | $900 | 4 of 16 | 25% |
| 2 | $1,200 | 6 of 16 | 37.5% |
| 3 | $1,500 | 4 of 16 | 25% |
| 4 | $1,800 | 1 of 16 | 6.25% |
What a 95% label can and cannot establish
An upper 95th-percentile drawdown summarizes the simulated drawdown distribution. A lower 5th-percentile ending return summarizes a different distribution. A confidence interval for an estimated statistic is another object. None alone gives a 95% guarantee that future equity will stay inside a plotted band at every step.
- Specify the statistic: cash drawdown, maximum percentage drawdown, terminal return or probability of crossing a capital threshold. They answer different questions.
- Specify the quantile rule. For 1,000 sorted results, Pineify selects zero-based index 950 for its 95% drawdown field and index 50 for its lower-return field: the 951st and 51st observations.
- More simulation runs reduce numerical sampling variation conditional on the model. They do not add unseen market regimes or repair biased trades.
- Do not call the worst sampled path a worst possible outcome. A future loss can exceed every observation in the input data.
Check dependence, missing tails and sizing assumptions
Independent bootstrap draws treat the trade sample as a stable outcome distribution without serial dependence. That assumption is doubtful when trades overlap, volatility changes or several losses arise from the same market event. The arch documentation provides stationary and fixed-length block bootstraps for time-series data; block length is itself a modeling decision.
| Failure condition | Why the simulation can mislead | Follow-up check |
|---|
| Loss clustering or overlapping positions | Independent draws remove the observed dependence. | Compare several block lengths; preserve joint timestamps for portfolio analysis. |
| A rare loss never appears in the sample | Resampling cannot invent a larger single-trade loss. | Run explicit gap, cost and liquidity stress scenarios separately. |
| Parameters selected on the same trades | Resampling reuses the selected sample and does not undo selection bias. | Freeze rules and evaluate an untouched period. |
| Historical position sizes change through time | Cash P&L mixes market outcomes with the original sizing decisions. | State whether the intended model uses cash, returns or risk units, then model resizing explicitly. |
| Intratrade or margin risk matters | Trade-close P&L misses interim exposure and liquidation rules. | Use a simulator with the required price path and broker constraints. |
Run the TradingView CSV workflow in Pineify
Backtest Deep Report reads TradingView List of Trades CSV data. TradingView exports each Strategy Report tab separately, so a Performance Summary CSV or OHLC price file is not the required trade list. The report includes the original equity curve in Charts and a separate Simulation view. Importing your own data currently requires Advanced or higher; the app also provides demo data.
- 1. Save the strategy version, symbol, timeframe, date range, capital, sizing, commission and slippage assumptions. Check for lookahead and repainting before exporting.
- 2. Download List of Trades from TradingView, import it and reconcile the trade count and net P&L. Confirm initial capital, direction filter and the open-trade setting.
- 3. Review the original equity curve, open Simulation and click Run Simulation. After changing the input or settings, run the simulation again.
- 4. Compare the modeled outcomes with your specified capital threshold and record limitations. Keep the original CSV and report output with your research notes.
Read the current report implementation precisely
The current engine takes 1,000 independent bootstrap samples of the selected net cash P&L values, each as long as the input list. It adds each sampled value to initial capital and displays the first 50 paths. The app may describe this as reshuffling, but trades are sampled with replacement. It does not rerun strategy entries, resize positions, model new prices or offer block sampling.
| Report detail | Current meaning | Interpretation limit |
|---|
| Drawdown fields | Percentage decline at the point of the largest cash drawdown in each path, then ranked across runs | This can differ from the largest percentage drawdown, which may occur at a different equity peak. |
| Min Return (95%) | Lower-tail ending return selected from the 1,000 final balances | A conditional sample quantile, even if the UI calls it confidence. |
| Risk of Ruin | Fraction of simulations whose final equity is zero or negative | Does not count every path that crosses zero earlier and later recovers; does not model margin liquidation. |
| Random seed and replay | Uses unseeded random draws; no seed control in the current interface | Reruns can differ. Saving the input alone does not reproduce an exact run. |
Keep an audit record for reproducible comparisons
A reproducible simulation record needs the input file or hash, filtering rules, capital, P&L units, sampling method, horizon, run count, random generator and seed, quantile convention, drawdown definition and stopping rule. SciPy exposes a random generator input for repeatable bootstrap behavior. Pineify currently has no seed control; record that limitation rather than inventing a seed for an existing run.
- Separate model changes from random variation. Compare the same input under named assumptions and retain the actual outputs.
- If exact replay, block resampling or a path-crossing ruin model is required, use an implementation that exposes those controls. The current Pineify report is a starting analysis of the supplied trades.