Skip to content

Backtest/sweep result metrics look wrong: CAGR overflow, maxDD% > 100%, win-rate/PnL inconsistency #5

Description

@leonardojgv

Backtest/sweep result metrics look wrong: CAGR overflow, maxDD% > 100%, win-rate/PnL inconsistency

Found while retesting #3 on 0.10.3, after backtests/sweeps started completing successfully again.
These are about the values returned for a COMPLETED run, not about jobs failing or hanging.

Strategy used throughout: a plain 9/21 (or swept) EMA crossover, AbstractTickerStrategy,
CrossDetector-based, long-only. binance / BTC/USDT in all cases.

1. CAGR overflows to a nonsensical value

Single backtest, 2026-08-102026-08-12:

P&L:          +25.6567
Trades:       1819 (win rate: 0.5%)
Sharpe:       0.446 | Sortino: 4.022
CAGR:         14150890090306516000000.00%
Max Drawdown: 0.08%

Every other metric on this run looks plausible. CAGR alone is off by ~20 orders of magnitude —
looks like an annualization exponent blowing up on a very short window (2 days), e.g.
(1+return)^(365/days) with days near zero or a unit mismatch (days vs. some smaller time unit)
feeding the exponent.

2. Max Drawdown reported above 100% on a spot (unleveraged) instrument

Two sweeps over the same window (2026-06-012026-06-05), grid and random samplers, varying
ema.fast/ema.slow — every single row in both leaderboards has maxDD% > 100%:

#1 params={ema.fast=15, ema.slow=30}   maxDD%=619.7165   pnl=-61971.6490   trades=3816
#2 params={ema.fast=15, ema.slow=20}   maxDD%=743.0957   pnl=-74309.5675   trades=4514
#3 params={ema.fast=10, ema.slow=30}   maxDD%=736.9358   pnl=-73693.5837   trades=4344
#4 params={ema.fast=5,  ema.slow=20}   maxDD%=1084.6523  pnl=-108465.2274  trades=6027
...

(full leaderboards available on request — happy to attach). BTC/USDT on binance is spot, no
margin/leverage in play, so equity going more than 100% underwater from peak shouldn't be
representable at all with a long-only strategy and no leverage — implies negative account equity.
Consistent double-digit-to-quadruple-digit maxDD% across every row of two independent sweeps
(12 total parameter combinations) suggests a systematic drawdown calculation issue rather than
one bad run.

3. Win rate and P&L directionally inconsistent on the same run

Same run as #1: 1819 trades, win rate 0.5%, but P&L is positive (+25.6567) and Sharpe is
positive (0.446)
. With a win rate that low, positive P&L requires winning trades to be roughly
200x the size of losing trades on average — possible in principle (huge asymmetric payoff) but
worth double-checking against the trade log, because it's exactly the kind of number a rounding or
field-mapping bug (e.g. win rate computed against the wrong trade set, or as wins / windowTicks
instead of wins / trades) would produce.

Ask

Would help to know whether these three share one root cause (e.g. a shared metrics-aggregation
step run after the backtest itself) or are independent — happy to pull more sample runs/full
leaderboards if useful for repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions