# Combinaisons optimales
combo_configs = [
# (fast, slow, pos_size, trail, sl, sma200, vol_scaling, label)
(20, 50, 0.95, None, None, False, False, "Baseline EMA 20/50, 95%"),
(20, 50, 0.95, None, None, True, False, "+ Filtre SMA200"),
(20, 50, 0.80, None, None, True, False, "+ SMA200 + Cap 80%"),
(20, 50, 0.80, 0.10, None, True, False, "+ SMA200 + Cap 80% + Trail 10%"),
(20, 50, 0.80, 0.10, 0.08, True, False, "+ SMA200 + Cap 80% + Trail 10% + SL 8%"),
(20, 50, 0.80, None, None, True, True, "+ SMA200 + Vol-scaling (cap 80%)"),
(20, 50, 0.80, 0.10, None, True, True, "+ SMA200 + Vol-scaling + Trail 10%"),
(10, 30, 0.80, None, None, True, False, "EMA 10/30 + SMA200 + Cap 80%"),
(15, 40, 0.80, None, None, True, False, "EMA 15/40 + SMA200 + Cap 80%"),
]
results_combo = {}
for fast, slow, pos, trail, sl, sma200, vol_s, label in combo_configs:
equity, metrics, trades = backtest_ema_strategy(
btc, fast_period=fast, slow_period=slow, position_size=pos,
trailing_stop=trail, stop_loss=sl, use_sma200=sma200, vol_scaling=vol_s,
min_position=0.40, max_position=pos
)
results_combo[label] = metrics
results_combo[label]['equity'] = equity
print(f"{'Config':<50} {'Sharpe':>7} {'CAGR':>8} {'MaxDD':>8} {'Trades':>7}")
print("-" * 85)
for label, m in results_combo.items():
marker = " <-- BASELINE" if "Baseline" in label else ""
# Highlight configs qui atteignent l'objectif
ok = " *** TARGET" if (m['max_dd'] > -0.35 and m['sharpe'] > 1.0) else ""
print(f"{label:<50} {m['sharpe']:>7.3f} {m['cagr']*100:>7.1f}% {m['max_dd']*100:>7.1f}% {m['n_trades']:>7}{marker}{ok}")