5ac4e16af8
Ondata di ricerca onesta a largo spettro su BTC/ETH+DVOL certificati: 104 ipotesi distinte (11 famiglie), un agente-finder per ipotesi, verifica avversariale a 3 scettici sui promettenti, sintesi (153 agenti totali). Esito: NIENTE di nuovo regge -> conferma del soffitto strutturale ~1.3 BTC/ETH-direzionale; lo stack TP01+XS01+VRP01 resta imbattuto. - altlib.py: harness condiviso vettoriale leak-free (eval_weights/study_weights, fee-sweep, both-asset + hold-out 2025+). Riproduce i numeri canonici di TP01. - MARGINAL SCORER (study_marginal/marginal_vs_tp01): Sharpe INCREMENTALE vs baseline TP01 (corr, blend uplift OOS, alpha residua) + jackknife OOS (clean-year + drop-best-month). earns_slot = abs!=FAIL & ADDS & robust_oos. Smaschera gli overlay su TSMOM con PASS assoluti fasulli (CMB04, VOL11, ...) e il falso positivo KAMA (ADDS ma muore al jackknife). - runs/*.py (104) script riproducibili per ipotesi; wf_altstrat.js workflow. - Verdetto: 0 candidati deployabili; 2 LEAD fragili (VOL08, STA05_LS) da forward-monitor. - test_marginal_scorer.py blocca baseline + invarianti. Suite: 32 verde. Diario: docs/diary/2026-06-20-alt-strategies-100agent-sweep.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
2.0 KiB
Python
69 lines
2.0 KiB
Python
"""BRK06 — Opening-Range Breakout (daily).
|
||
|
||
HYPOTHESIS: On 1d bars, go LONG when today's close > prior-day high (expansion/gap breakout).
|
||
SL = prior-day low. max_bars = configurable (3 or 5). No short side (breakdowns symmetric but
|
||
crypto skew is upward; testing long-only first). Entry at close[i] once close[i] > prior high[i-1].
|
||
Exit at SL=prior_low[i-1] or max_bars (time stop), whichever first.
|
||
|
||
Grid: max_bars in {3, 5} -> 2 configs × 1 TF × 2 assets = 4 backtests.
|
||
|
||
Honesty rules:
|
||
- decision uses close[i] vs high[i-1]: CAUSAL (prior-bar high is known by close of bar i).
|
||
- SL = low[i-1]: known causal.
|
||
- entry = close[i] (not high/low extreme of bar i).
|
||
- fee = 0.10% RT (Deribit taker).
|
||
"""
|
||
import sys
|
||
sys.path.insert(0, "/opt/docker/PythagorasGoal/scripts/research/alt")
|
||
import altlib as al
|
||
import numpy as np
|
||
|
||
def make_entries(df, max_bars: int):
|
||
"""Long when close[i] > high[i-1]. SL = low[i-1]. Exit at max_bars or SL."""
|
||
c = df["close"].values
|
||
h = df["high"].values
|
||
lo = df["low"].values
|
||
n = len(c)
|
||
entries = [None] * n
|
||
for i in range(1, n):
|
||
prior_high = h[i - 1]
|
||
prior_low = lo[i - 1]
|
||
if c[i] > prior_high:
|
||
# Long breakout: entry at close[i], SL below prior-day low
|
||
# TP = None (let the time-stop manage exit)
|
||
entries[i] = {
|
||
"dir": 1,
|
||
"tp": None,
|
||
"sl": prior_low,
|
||
"max_bars": max_bars,
|
||
}
|
||
return entries
|
||
|
||
|
||
configs = [
|
||
{"max_bars": 3},
|
||
{"max_bars": 5},
|
||
]
|
||
|
||
best_rep = None
|
||
best_score = -9999
|
||
|
||
for cfg in configs:
|
||
name = f"BRK06-mb{cfg['max_bars']}"
|
||
rep = al.study_signals(
|
||
name,
|
||
lambda df, mb=cfg["max_bars"]: make_entries(df, mb),
|
||
tfs=("1d",),
|
||
)
|
||
print(al.fmt(rep))
|
||
score = rep["verdict"].get("best_holdout_sharpe", -9999)
|
||
if score is None:
|
||
score = -9999
|
||
if score > best_score:
|
||
best_score = score
|
||
best_rep = rep
|
||
|
||
print("\n=== BEST CONFIG ===")
|
||
print(al.fmt(best_rep))
|
||
print("JSON:", al.as_json(best_rep))
|