Lab · ML Experiments

ML — Pattern Discovery

Inverted workflow: find conditional edges in BTC data first, build strategies second.
55 experiments

BOCPD Entry-Filter Backtest — Trend Strategies

Promoted
2026-05-19 filterbocpdbacktestproduction-gate
Hypothesis
Blocking entries when BOCPD p_short > threshold improves trend-strategy risk-adjusted PnL on BTC. Test at thresholds 0.3 / 0.5 / 0.7 against the no-filter baseline across EMA_PURE, EMA_MACD, HOLY_GRAIL over a 2-year+ window.
Verdict
**SHIP** — BOCPD filter promotes 3/6 strategies. Add `bocpd_filter` to those configs in production.
n_hurt
1
n_promote
3
window_to
2026-04-01
n_marginal
2
window_from
2023-01-01
n_strategies
6
EMA_MACD_dd_delta_pp
+0.0013
EMA_PURE_dd_delta_pp
+0.0007
EMA_MACD_pnl_lift_pct
+0.6891
EMA_PURE_pnl_lift_pct
+0.4776
HOLY_GRAIL_dd_delta_pp
+0.0000
EMA_MACD_best_threshold
+0.3000
EMA_PURE_best_threshold
+0.3000
HOLY_GRAIL_pnl_lift_pct
+0.0000
BB_EXTREME_1_dd_delta_pp
+0.0011
BB_EXTREME_2_dd_delta_pp
+0.0121
BB_EXTREME_3_dd_delta_pp
+0.0083
BB_EXTREME_1_pnl_lift_pct
+12.6457
BB_EXTREME_2_pnl_lift_pct
+17.0414
BB_EXTREME_3_pnl_lift_pct
+6.8836
HOLY_GRAIL_best_threshold
+1.0000
BB_EXTREME_1_best_threshold
+0.3000
BB_EXTREME_2_best_threshold
+0.3000
BB_EXTREME_3_best_threshold
+0.3000

BOCPD Entry-Filter Backtest — Trend Strategies

2026-05-19 · status: promoted · 100.9s

Hypothesis: Blocking entries when BOCPD p_short > threshold improves trend-strategy risk-adjusted PnL on BTC. Test at thresholds 0.3 / 0.5 / 0.7 against the no-filter baseline across EMA_PURE, EMA_MACD, HOLY_GRAIL over a 2-year+ window.

Verdict: SHIP — BOCPD filter promotes 3/6 strategies. Add bocpd_filter to those configs in production.

Key metrics

metric value
n_strategies 6
n_promote 3
n_marginal 2
n_hurt 1
window_from 2023-01-01
window_to 2026-04-01
EMA_PURE_best_threshold +0.3000
EMA_PURE_pnl_lift_pct +0.4776
EMA_PURE_dd_delta_pp +0.0007
EMA_MACD_best_threshold +0.3000
EMA_MACD_pnl_lift_pct +0.6891
EMA_MACD_dd_delta_pp +0.0013
HOLY_GRAIL_best_threshold +1.0000
HOLY_GRAIL_pnl_lift_pct +0.0000
HOLY_GRAIL_dd_delta_pp +0.0000
BB_EXTREME_3_best_threshold +0.3000
BB_EXTREME_3_pnl_lift_pct +6.8836
BB_EXTREME_3_dd_delta_pp +0.0083
BB_EXTREME_1_best_threshold +0.3000
BB_EXTREME_1_pnl_lift_pct +12.6457
BB_EXTREME_1_dd_delta_pp +0.0011
BB_EXTREME_2_best_threshold +0.3000
BB_EXTREME_2_pnl_lift_pct +17.0414
BB_EXTREME_2_dd_delta_pp +0.0121

Approach

Run three trend strategies (EMA_PURE, EMA_MACD, HOLY_GRAIL) over 2023-01-012026-04-01 with the new bocpd_filter at four thresholds: 1.0 (off), 0.7, 0.5, 0.3. For each (strategy × threshold) cell we report total PnL, # trades, win rate, trade-Sharpe, and max drawdown. The baseline (1.0) shows what each strategy does without the filter; lower thresholds block more entries.

Counterfactual analysis: for the baseline runs we record the BOCPD p_short value at each trade's entry. Trades with p_short > θ would have been blocked at threshold θ. Their net contribution to PnL tells us why the filter would help or hurt.

Total PnL ($) — rows=strategy, cols=threshold

strategy 0.3 0.5 0.7 1.0
BB_EXTREME_1 17.23 16.76 16.2 15.3
BB_EXTREME_2 20.67 19.76 18.9 17.66
BB_EXTREME_3 12.21 12.12 12.12 11.42
EMA_MACD -18.84 -19.37 -19.03 -18.97
EMA_PURE -17.58 -18.46 -18.08 -17.67
HOLY_GRAIL -0.83 -0.83 -0.83 -0.83

# Trades

strategy 0.3 0.5 0.7 1.0
BB_EXTREME_1 146 149 156 165
BB_EXTREME_2 115 120 128 139
BB_EXTREME_3 95 97 110 124
EMA_MACD 1225 1231 1233 1234
EMA_PURE 1006 1020 1027 1039
HOLY_GRAIL 27 27 27 27

Win rate

strategy 0.3 0.5 0.7 1.0
BB_EXTREME_1 0.1233 0.1208 0.1218 0.1152
BB_EXTREME_2 0.1652 0.1583 0.1484 0.1367
BB_EXTREME_3 0.0842 0.0825 0.0727 0.0645
EMA_MACD 0.3282 0.3274 0.3293 0.3298
EMA_PURE 0.326 0.3255 0.3281 0.3282
HOLY_GRAIL 0.5556 0.5556 0.5556 0.5556

Max DD (%)

strategy 0.3 0.5 0.7 1.0
BB_EXTREME_1 -0.03 -0.03 -0.03 -0.03
BB_EXTREME_2 -0.03 -0.03 -0.04 -0.04
BB_EXTREME_3 -0.02 -0.02 -0.02 -0.02
EMA_MACD -0.19 -0.19 -0.19 -0.19
EMA_PURE -0.18 -0.19 -0.18 -0.18
HOLY_GRAIL -0.01 -0.01 -0.01 -0.01

Sharpe (trade-level)

strategy 0.3 0.5 0.7 1.0
BB_EXTREME_1 2.148 2.066 1.953 1.735
BB_EXTREME_2 2.914 2.724 2.521 2.182
BB_EXTREME_3 3.08 3.023 2.669 2.362
EMA_MACD -2.19 -2.242 -2.2 -2.185
EMA_PURE -2.515 -2.61 -2.542 -2.43
HOLY_GRAIL -2.895 -2.895 -2.895 -2.895

Counterfactual: PnL of trades that would be blocked

strategy threshold n_blocked blocked_pnl blocked_mean_pnl kept_mean_pnl n_kept kept_pnl total_pnl_baseline
EMA_PURE 1 0 0 -0.02 1039 -17.67 -17.67
EMA_PURE 0.7 25 0.06 +0.00 -0.02 1014 -17.73 -17.67
EMA_PURE 0.5 33 0.09 +0.00 -0.02 1006 -17.76 -17.67
EMA_PURE 0.3 55 0.22 +0.00 -0.02 984 -17.89 -17.67
EMA_MACD 1 0 0 -0.02 1234 -18.97 -18.97
EMA_MACD 0.7 18 -0.42 -0.02 -0.02 1216 -18.55 -18.97
EMA_MACD 0.5 24 -0.88 -0.04 -0.01 1210 -18.09 -18.97
EMA_MACD 0.3 37 -0.31 -0.01 -0.02 1197 -18.66 -18.97
HOLY_GRAIL 1 0 0 -0.03 27 -0.83 -0.83
HOLY_GRAIL 0.7 1 -0.15 -0.15 -0.03 26 -0.68 -0.83
HOLY_GRAIL 0.5 1 -0.15 -0.15 -0.03 26 -0.68 -0.83
HOLY_GRAIL 0.3 2 -0.43 -0.22 -0.02 25 -0.4 -0.83
BB_EXTREME_3 1 0 0 0.09 124 11.42 11.42
BB_EXTREME_3 0.7 5 -0.22 -0.04 0.1 119 11.65 11.42
BB_EXTREME_3 0.5 8 -0.36 -0.04 0.1 116 11.78 11.42
BB_EXTREME_3 0.3 12 -0.55 -0.05 0.11 112 11.98 11.42
BB_EXTREME_1 1 0 0 0.09 165 15.3 15.3
BB_EXTREME_1 0.7 8 5.45 +0.68 0.06 157 9.85 15.3
BB_EXTREME_1 0.5 11 5.2 +0.47 0.07 154 10.1 15.3
BB_EXTREME_1 0.3 14 4.78 +0.34 0.07 151 10.52 15.3
BB_EXTREME_2 1 0 0 0.13 139 17.66 17.66
BB_EXTREME_2 0.7 8 5.51 +0.69 0.09 131 12.15 17.66
BB_EXTREME_2 0.5 12 5.12 +0.43 0.1 127 12.53 17.66
BB_EXTREME_2 0.3 16 4.63 +0.29 0.11 123 13.02 17.66

Reading the table: blocked_pnl is the net PnL of trades whose entry BOCPD score exceeded the threshold. If blocked_pnl is negative, the filter would have removed losing trades → net win. If positive, the filter would have removed profitable trades → net loss.

Per-strategy verdicts

  • EMA_PURE: MARGINAL_UNPROFITABLE — θ=0.3: PnL -17.58 (+0.5%), DD -0.1789.

  • EMA_MACD: MARGINAL_UNPROFITABLE — θ=0.3: PnL -18.84 (+0.7%), DD -0.1886.

  • HOLY_GRAIL: FILTER HURTS — baseline (off) is the best variant.

  • BB_EXTREME_3: PROMOTE — θ=0.3: PnL +12.21 (+6.9%), DD -0.0157 (baseline -0.0240, Δ +0.83 bps).

  • BB_EXTREME_1: PROMOTE — θ=0.3: PnL +17.23 (+12.6%), DD -0.0319 (baseline -0.0330, Δ +0.11 bps).

  • BB_EXTREME_2: PROMOTE — θ=0.3: PnL +20.67 (+17.0%), DD -0.0327 (baseline -0.0448, Δ +1.21 bps).

pnl/dd vs threshold

p_short dist

Overall verdict

SHIP — BOCPD filter promotes 3/6 strategies. Add bocpd_filter to those configs in production.