Class TradeAnalytics
java.lang.Object
com.quantfinlib.backtest.TradeAnalytics
TRADE-LEVEL analytics — the numbers a discretionary reviewer asks for
that a Sharpe ratio hides. Two strategies with the same Sharpe can have
completely different trade signatures: one wins small and often with a
few large losses (a hidden short-gamma profile that blows up), the
other loses small and often with rare large wins (trend following, hard
to hold). These statistics expose the difference.
- expectancy — the average P&L per trade,
winRate*avgWin - lossRate*avgLoss: the single number that says whether the edge survives being averaged over every trade; - payoff ratio — avgWin / avgLoss: paired with win rate it IS the strategy's character. A 40% win rate needs a payoff above 1.5 to have positive expectancy — the arithmetic that kills most "high win rate" systems whose few losses are huge;
- streaks — the longest run of consecutive losers (and winners): the number that decides whether you can psychologically and financially SIT through the strategy. A positive-expectancy system with an 11-trade losing streak gets turned off by its owner at trade 8;
- Kelly fraction —
W - (1-W)/Rfor win rate W and payoff R: the growth-optimal bet size the trade record implies, and a reality check (a Kelly above ~0.25 usually means the sample is too small or the wins too lucky); - hold times — average bars held for winners vs losers: when losers are held far longer than winners, that is the disposition effect showing up in the tape.
All statistics are on realized Trade P&L; a strategy with
no losing trades reports an infinite payoff ratio and Kelly clamped to
1 (bet everything — which is exactly the over-fit warning you want).
Static, deterministic, research lane. Complements
PerformanceAnalytics (equity-curve metrics) and
validation.MonteCarloTradeShuffle (is the SEQUENCE luck?).
-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
analyze
- Parameters:
trades- completed trades, non-empty
-