Files
PythagorasGoal/docs/diary/2026-06-19-trackD-trendport.md
T
Adriano Dal Pastro d152941360 integra(TP01): merge ricerca branch strategy-research-2026-06 (squash) — strategia vincente + harness + track A-E
Integra il lavoro della linea di ricerca parallela (AdrianoDev), verificato indipendentemente
col mio gauntlet onesto (regge il hold-out 2025-26 su entrambi gli asset, plateau 1h/4h/1d):
- src/strategies/trend_portfolio.py  TP01 (TSMOM 30/90/180 vol-target 20% lev2x long-flat, 50/50 BTC+ETH)
- src/backtest/harness.py            harness onesto (load + backtest_signals no-leakage + OOS)
- scripts/research/track{A,B,C,D,E}_*.py + trackD_timing.py  (le 5 track della ricerca)
- scripts/live/paper_trend.py        paper trader forward-only di TP01 (no esecuzione reale)
- tests/test_trend_portfolio.py (5 test, passano) + 6 diari trackA-E + synthesis
- CLAUDE.md aggiornato con l'esito ricerca (TP01 vincente, mean-rev morto, onesta su €50/g)

Squash (non merge) per NON portare in git i ~68MB di data/_feed_backup/*.bak che il branch
aveva committato per errore: esclusi + data/_feed_backup/ e data/paper_trend/ ora gitignorati.
Storia granulare del branch conservata sul ref origin/strategy-research-2026-06.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 18:55:04 +00:00

97 lines
6.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 2026-06-19 — Track D: Robust walk-forward TREND PORTFOLIO (BTC+ETH), vol-targeted + leverage
Follow-up to Track A. Thesis under test: trend-following's real value in crypto is **drawdown
reduction** vs buy & hold (it sidesteps crashes), and that lower DD lets you apply **leverage** and
**diversify** BTC+ETH into a deployable, risk-adjusted *earning* system — even if each single signal
has modest Sharpe. Tool: `scripts/research/trackD_trendport.py` (run
`uv run python scripts/research/trackD_trendport.py`).
## Method (honest, no look-ahead)
Equity built directly from a **target-position series** (the harness's documented "build your own
equity" path), NOT per-trade chaining:
- `target[i]` decided with data **≤ close[i]**; **held during the next bar** (close[i]→close[i+1]).
- `pnl[t] = target[t-1]·r[t]`, `r[t]=close[t]/close[t-1]-1` — positions **shifted +1 bar** ⇒ no leakage.
- Fees on **turnover**: `0.05%/side·|target[t-1]-target[t-2]|` (0.10% RT baseline; swept 0.100.40% RT).
- **Vol-targeting** (main lever): `target = direction · (target_vol / realized_vol)`, clipped to the
leverage cap. `realized_vol` = annualized rolling std of past bar returns (30d window), ≤ close[i].
- **Portfolio** = 50/50 BTC+ETH net-return series, rebalanced each bar on common timestamps.
Leakage sanity check passed: an *oracle* target using next-bar sign explodes (10^119×) — proving the
engine holds `target[i-1]` over bar `i` — while our signals (TSMOM blend, MA-slope, Donchian) only use
`close[i]` and earlier. Zero-position equity = exactly 1.0.
## What was tested
TSMOM multi-horizon blend (1/3/6-month-equiv on 1h bars), MA-slope (EMA200 slope), Donchian breakout
with trailing channel stop — each vol-targeted, long-short **and** long-flat, per-asset and combined.
Grid: target-vol × leverage-cap × horizon-set; explicit EARLY(2018-21)/LATE(2022-26) split;
fee & leverage sweep; full per-year 2018-2026.
## Results — the honest picture
**1) The thesis holds: massive DD reduction, and diversification helps.**
| Strategy (50/50 port, tvol20%, LS) | CAGR | Sharpe | maxDD | volA |
|---|---|---|---|---|
| **B&H 50/50** | +48% | 0.92 | **77.8%** | 70% |
| TSMOM 1-3-6m blend | +14.2% | **1.00** | **18.9%** | 14% |
| MA-slope | +14.1% | 0.79 | 21.9% | 19% |
| Donchian-trailing | +14.7% | 0.89 | 17.7% | 17% |
Trend cuts maxDD from ~78% to ~18% while keeping a Sharpe **above** buy&hold (1.00 vs 0.92). The
portfolio Sharpe (1.00) **beats both sleeves** (BTC 0.95, ETH 0.75) — diversification works as claimed.
The **long-flat** variant is even cleaner: Sharpe **1.32**, maxDD **13.3%** (no short funding/borrow risk).
**2) It is genuinely robust (not a lucky cell).**
- *Per-year (headline LS):* every full year **positive** 2019-2025 (+19/+36/+19/+6/+2/+14/+4%) and 2026 +8%.
- *Grid:* Sharpe ≈1.00 across **all** target-vol (10-40%) × leverage caps — flat plateau (vol-targeting
just scales). DD scales ~linearly with target-vol (10%→DD10%, 40%→DD35%).
- *Horizon-set:* every subset (1m/3m/6m/1-3m/3-6m/1-2-4m/2-4-8m) is **positive**; Sharpe 0.37→1.39.
Shorter horizons (1m, 1-2-4m) score best (Sharpe 1.34-1.39) — a real plateau, not one combo.
- *Fee:* survives to 0.40% RT (Sharpe 1.00→0.39, still positive at 4× baseline fee).
**3) The honest caveat — most of the edge is the EARLY regime.**
Walk-forward split, same param set both assets:
- **EARLY 2018-2021:** CAGR +26%, Sharpe **1.63**, DD 18%.
- **LATE 2022-2026:** CAGR +7.3%, Sharpe **0.57**, DD 19%.
The signal is real and still net-positive every late year, but its quality **halved** post-2021
(crypto vol compressed, trends choppier). This is the same warning Track A raised, now quantified: the
edge is strongest 2019-2021 and merely *modest* in the 2022-26 regime.
**4) Leverage is a red herring; target-vol is the real dial — and it costs DD linearly.**
At tvol=20% on 60-80% crypto vol, positions stay **sub-1x** (avg gross 0.23×): the leverage cap
**never binds**. To deploy real leverage you raise target-vol; Sharpe stays ~1.0, DD scales:
| target_vol | avg gross | CAGR | Sharpe | maxDD |
|---|---|---|---|---|
| 20% | 0.23× | +14% | 1.00 | 19% |
| 40% | 0.45× | +28% | 1.00 | 35% |
| 60% | 0.68× | +40% | 1.00 | 48% |
| 80% | 0.90× | +50% | 1.00 | 60% |
| 100% | 1.12× | +58% | 0.99 | 69% |
## Verdict — is this a deployable earning system?
**Yes as a risk-adjusted system; NO as a fast path to €50/day on €2000.**
- This is the **first post-reset config that is genuinely robust**: Sharpe ~1.0 (long-flat 1.3),
positive every year 2018-2026, robust across grid/horizon/fee, on both assets, on certified data,
with honest no-look-ahead accounting. It is a real, deployable trend portfolio and a clear
improvement over Track A's lucky single cells. The thesis (DD reduction → leverageable, diversifiable)
is **confirmed**.
- **But the earnings are modest.** Headline (tvol20%, 2x cap, LS): CAGR **+14.2%**, DD 19% ⇒ steady-state
**~€0.73/day on €2000**. To average **€50/day at this CAGR you need ~€137k capital**, not €2000.
- **Leverage can't close the gap cheaply.** Pushing target-vol to 80% gives CAGR ~50% (DD **60%**) — and
at €2000, 50%/yr is still only ~€2.7/day in steady state. Reaching €50/day in 1-2 years from €2000
would require both heavy leverage (DD 60-70%, near-ruin) **and** lucky path — not a sane plan.
- **Regime risk:** the edge is much weaker post-2021 (Sharpe 0.57 LATE). Deploy sized for the LATE
regime, not the EARLY one.
**Recommendation:** treat this as the **core risk engine** (compounding ~14%/yr at DD<20%, or
long-flat ~16%/yr at DD 13%), deployable now at low size to validate live execution. It grows €2000,
but to *€50/day* the lever is **capital + time**, not leverage. Realistic near-term: ~€0.7-1.5/day on
€2000; €50/day needs ~€70-140k or a second uncorrelated edge stacked on top.
## Deliverable
`scripts/research/trackD_trendport.py` — self-contained, prints B&H benchmark, broad scan, grid
robustness, horizon robustness, walk-forward early/late, fee+leverage sweep, headline config per-year,
and the path-to-€50/day table. Reusable building blocks (vol-targeting, target→equity, portfolio).