eac2aa1d00
- trackD_lookahead_audit.py: relabel test (left==right, no labeling leak) + execution-lag stress -> our trend pipeline is CLEAN (4h Sharpe 1.36 robust to +1 bar lag, label-invariant) - ADOPT conservative conclusion: deploy at 12h (sub-12h: costs/overfit dominate, slight Sharpe bump unreliable). 12h: Sharpe 1.32, DD 13.3%, CAGR 16.2% ~ identical and robust - trend_portfolio: DEPLOY_TF=12h, resample_tf(rule); paper trader + tests on 12h - calendar research (NEGATIVE, both): trackF seasonality (spurious), trackG prior-levels (breakouts continue, fade dead; only long-drift survivor, redundant with TP01) - gitignore data/paper_trend runtime state
4.6 KiB
4.6 KiB
Track G — Prior-period level breakouts / range (BTC & ETH, calendar-anchored)
Data: 2026-06-19 · Script: scripts/research/trackG_prior_levels.py
Harness: src/backtest/harness.py (honest, entry decided at close[i], fill close[i]).
Domanda
Esistono edge net-positivi OOS, robusti su BTC e ETH, definiti rispetto a un periodo calendario precedente (giorno/settimana/opening-range)? E soprattutto: i breakout di livello continuano (trend) o rientrano (fade)?
No look-ahead (garanzie)
- Livelli prior-day/week costruiti aggregando a barre giornaliere/settimanali (UTC) e poi
shift(1)sul frame del periodo chiuso: il periodo corrente vede solo il precedente totalmente chiuso. Mai "oggi"/"questa settimana" nel livello. - Opening-range usato solo sulle barre dopo la chiusura della finestra di apertura.
- Direzione + prezzo decisi a
close[i], fill aclose[i]. Mai entry sul livello esatto intrabar. - Bug iniziale corretto: mismatch tz-aware vs tz-naive nel mapping dei livelli (dava 0 trade).
Risultati (1h, fee 0.10% RT, leva 1x, OOS 65/35)
Continuation vs FADE — il verdetto è netto
| Regola (PD = prior-day) | BTC OOS | ETH OOS | Sharpe OOS |
|---|---|---|---|
| PD-high CONT (long su rottura max ieri) | +25% | +16% | +0.5 / +0.3 |
| PD-high FADE | −68% | −68% | −1.6 / −1.2 |
| PD-low CONT (short su rottura min ieri) | −33% | −60% | −0.5 / −0.8 |
| PD-low FADE | −36% | −8% | −0.6 / +0.1 |
- I breakout CONTINUANO, non rientrano. Il lato FADE è robustamente negativo su entrambi gli asset (sia high che low), su prior-day, prior-week e opening-range. Conferma diretta della tesi del reset: la mean-reversion / fade è morta su dati certificati.
- Asimmetria long-only: funziona solo la rottura del massimo (long), non quella del minimo (short). Cioè non è un edge di breakout simmetrico/direzione-neutro: è cattura del drift/trend rialzista del cripto. La PD-low-cont (short sui breakdown) perde perché in questo campione il cripto sale.
Grid robustness (PASS 6) — survivor = OOS>0 su ENTRAMBI
- PD-high CONT: 3/3 celle (buffer 0/0.1%/0.3%) positive OOS su BTC e ETH → robusto al buffer.
- PD-high fade, PD-low cont/fade, OR-fade: 0 survivor.
- OR-cont: positiva solo su ETH, negativa su BTC su tutte le finestre (3/6/8/12h) → artefatto mono-asset, scartato dalla regola "entrambi".
Anchor-hour sweep (PASS 5) — non è un'ora fortunata
PD-high cont positiva su 21/24 ore UTC (BTC) e 20/24 (ETH). Non dipende da un singolo anchor → coerente con un edge reale (ma vedi sotto: è beta di trend).
Fee sweep + per-anno (PD-high cont, full sample)
BTC RT%: 0.00→+571 0.05→+289 0.10→+126 0.15→ +31 0.20→ −24 (OOS: +84/+52/+25/+3/−15)
ETH RT%: 0.00→+1754 0.05→+1012 0.10→+567 0.15→+299 0.20→+139 (OOS: +67/+39/+16/−3/−19)
BTC per-anno: 2019 +39 2020 +104 2021 +7 2022 −42 2023 +24 2024 +27 2025 −16 2026 +3
ETH per-anno: 2020 +164 2021 +160 2022 +7 2023 +1 2024 +12 2025 −4 2026 +7
Sharpe full: BTC +0.48 (maxDD 55%, €/d 2k +0.88) · ETH +0.86 (maxDD 34%, €/d 2k +4.27)
- Fee-fragile: alla baseline 0.10% RT sopravvive (OOS +25/+16%), ma muore già a ~0.15-0.20% RT. Margine di fee sottile (≈1.5x baseline e l'edge sparisce su OOS). ~1000-1100 trade in 8 anni.
- Drawdown enormi (BTC 55%) e anni negativi (2022 −42% BTC, 2025 −16%).
Verdetto
- Sì, esiste un edge net-positivo OOS su entrambi gli asset: PD-high continuation (long
quando
closesupera il massimo di ieri, exit a fine giornata UTC). Robusto al buffer e all'anchor-hour. MA non è deployabile come miglioramento:- È long-only drift capture, non un breakout simmetrico (il lato short fallisce) → è una versione più debole e ridondante del Trend Portfolio TP01 (Sharpe 0.48-0.86 vs 1.32).
- Fee-fragile (muore a ~1.5x la fee baseline) e con drawdown molto peggiori.
- Il contributo scientifico vero è la conferma della direzione: sui dati certificati i breakout di livello-calendario CONTINUANO; il fade è morto (negativo robusto su PD/PW/OR, entrambi gli asset). Nessuna sorpresa mean-reversion nascosta nei livelli giornalieri/settimanali.
- Niente di nuovo da mettere in produzione. TP01 resta la strategia vincente; i breakout prior-period non aggiungono Sharpe (stessa beta di trend, peggio eseguita).
Come riprodurre
uv run python scripts/research/trackG_prior_levels.py # full (1h + 15m, ~25s)
uv run python scripts/research/trackG_prior_levels.py --quick # 1h only