Class MonteCarloTradeShuffle
What reshuffling holds fixed and what it breaks: it preserves the
multiset of trade outcomes (win rate, average win/loss, profit factor
are invariant) and destroys their order, so it isolates
"path/sequencing risk" from "edge". Its blind spot: it assumes trades
are exchangeable, so it understates risk for a strategy whose losses
cluster (serial correlation, regime dependence). A martingale that
wins small and loses catastrophically looks tamer reshuffled than it
is. For serially-correlated paths use BlockBootstrap on the
return series; this class is the per-trade complement, and the two
disagreeing is itself the signal that your trades are not
independent.
The path compounds each trade's Trade.returnPct() (return on
the capital committed at entry): wealth W_k = Π_{j≤k}(1 + r_j)
from 1. Reshuffling currency P&L instead would be wrong for an
all-in compounding book, where a trade's currency P&L depends on the
equity at the time it was taken. Drawdowns are fractions of the running
peak, terminal values are total returns. Percentiles come from
Stats.quantile. Deterministic given the seed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDrawdown distribution across trade-order shuffles. -
Method Summary
Modifier and TypeMethodDescriptionShuffles the trade order and records the drawdown distribution.
-
Method Details
-
analyze
Shuffles the trade order and records the drawdown distribution.- Parameters:
trades- the strategy's completed trades, at least 2shuffles- number of shuffles, at least 100seed- random seed
-