Skip to content

Commit 43111ec

Browse files
JohnCCarterclaude
andcommitted
feat(research): add BTC MTF confluence table
Checkpoint 1 of the MTF confluence atlas. New stdlib module research/mtf_confluence.py flattens the locked BTC/USD source-fib corpus (462 fibs -> 2772 level rows) and clusters stored fib levels by log-price proximity (epsilon_log=0.005, fixed before results) plus overlapping anchor time-windows, requiring >=2 distinct timeframes. Result: 222 cross-TF clusters (2x4-TF, 24x3-TF; 1d,4h dominates). Connected-component single-linkage; price_span_log reported so chaining (30/222 > eps) is visible. Report-only: no chart, no trading conclusions, no tuning. 10 tests. Committed confluence CSV under docs; large levels CSV gitignored. Stop/go: GO to CP2 (sensitivity). README/handoff/log updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 44c50ac commit 43111ec

7 files changed

Lines changed: 952 additions & 3 deletions

File tree

docs/research_wiki/handoff.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,11 @@ JSON unchanged, no new deps, no artifacts committed.
138138
No open implementation items remain in the #32 tooling track. **Corpus declared clean and
139139
locked** (integrity capstone 2026-06-15:
140140
[`reviews/btc-source-fib-corpus-integrity-20260615.md`](reviews/btc-source-fib-corpus-integrity-20260615.md)).
141-
**Next analytical pass: #1 MTF confluence atlas** — first slice a read-only confluence
142-
table (no chart, no trading conclusions). Design:
143-
[`reviews/btc-source-fib-next-research-plan-20260615.md`](reviews/btc-source-fib-next-research-plan-20260615.md).
141+
**MTF confluence atlas in progress.** CP1 (confluence table) DONE — `research/mtf_confluence.py`
142+
(stdlib): 222 cross-TF clusters at epsilon_log=0.005 (2×4-TF); GO to CP2.
143+
[CP1 report](reviews/btc-mtf-confluence-table-20260615.md). **Next: CP2**
144+
sensitivity/robustness (multi-epsilon + complete-linkage), read-only, no tuning-to-fit.
145+
Design: [`reviews/btc-source-fib-next-research-plan-20260615.md`](reviews/btc-source-fib-next-research-plan-20260615.md).
144146

145147
**Deferred:** 1H source labeling — 4H is the lowest active timeframe; fetch 1H cache first
146148
(`data.fetch --timeframes 1h`). Separate decision before starting.

docs/research_wiki/log.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ Types: `ingest`, `decision`, `review`, `question`, `maintenance`.
1414
> Older entries (2026-06-10 and earlier): [part 3](log-archive-pre-btc-reset-part3.md)
1515
> [part 2](log-archive-pre-btc-reset-part2.md)[part 1](log-archive-pre-btc-reset-part1.md)
1616
17+
## [2026-06-15] review | MTF confluence atlas CP1 — confluence table
18+
19+
First analytical slice on the locked corpus. New stdlib module `research/mtf_confluence.py`
20+
(10 tests): flattens 462 fibs → 2772 level rows, clusters by log-price proximity
21+
(epsilon_log=0.005, chosen before results) + overlapping anchor windows, requires ≥2 TFs.
22+
Result: **222 clusters** (2×4-TF, 24×3-TF; 1d,4h dominates 143). Chaining visible
23+
(30/222 span>eps, reported). **Stop/go: GO** to CP2 (sensitivity/robustness, multi-eps +
24+
complete-linkage). No chart, no trading conclusions, no tuning. Committed CSV under docs;
25+
large levels CSV gitignored.
26+
[Report](reviews/btc-mtf-confluence-table-20260615.md).
27+
1728
## [2026-06-15] review | BTC source-fib corpus integrity report (capstone)
1829

1930
Read-only capstone locking the corpus before the MTF analytical pass. Re-derived on disk:

docs/research_wiki/reviews/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ on 2026-06-08. They are **not** current evidence.
2828
| [btc-4h-fib-20250506-dedup-20260615.md](btc-4h-fib-20250506-dedup-20260615.md) | 20250506 dedup — fib A superseded, fib B retained (active 4H 366→365) |
2929
| [btc-source-fib-next-research-plan-20260615.md](btc-source-fib-next-research-plan-20260615.md) | Next research-pass design (read-only) — recommends corpus integrity report (#2) now, MTF confluence atlas (#1) next |
3030
| [btc-source-fib-corpus-integrity-20260615.md](btc-source-fib-corpus-integrity-20260615.md) | Corpus integrity capstone (read-only) — counts 9/21/67/365, conventions, source-quality state, known caveats; corpus declared clean. Next: MTF confluence atlas |
31+
| [btc-mtf-confluence-table-20260615.md](btc-mtf-confluence-table-20260615.md) | MTF confluence atlas CP1 (read-only) — 222 cross-TF level clusters at epsilon_log=0.005 (2×4-TF); GO to CP2 sensitivity. `research/mtf_confluence.py` (stdlib) + CSV |

docs/research_wiki/reviews/btc-mtf-confluence-table-20260615.csv

Lines changed: 223 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# BTC/USD MTF Confluence Table — Checkpoint 1 (2026-06-15)
2+
3+
Read-only confluence table. **First slice of the MTF confluence atlas (#1).** Answers one
4+
structural question on the locked corpus: *do stored fib level prices from ≥2 timeframes
5+
cluster together in log-price while their anchor time-windows overlap?*
6+
7+
**Scope honored:** read-only, no chart, no visual atlas, no trading/signal/edge
8+
interpretation, no 1H, no reaction-review, no auto-fib, no source-label change, no epsilon
9+
tuning, no new deps, no committed PNG/artifacts. New code is stdlib-only + tested.
10+
11+
Helper: [`research/mtf_confluence.py`](../../../src/fibengine/research/mtf_confluence.py)
12+
(stdlib, 10 tests). Committed table: [btc-mtf-confluence-table-20260615.csv](btc-mtf-confluence-table-20260615.csv).
13+
14+
---
15+
16+
## Observed
17+
18+
- Active corpus flattened to level rows: **2772 level rows from 462 fibs** (1M=9, 1w=21,
19+
1d=67, 4h=365; each fib contributes its 6 stored levels). Superseded
20+
`20250506T080000` is absent (deleted) — not loaded.
21+
- At the fixed primary threshold **epsilon_log = 0.005** (≈0.5% log-price), with the
22+
cross-TF (≥2 distinct timeframes) + overlapping-anchor-window requirement:
23+
**222 confluence clusters**.
24+
- price_span_log distribution across clusters: min 0.0, median **0.00199**, max **0.01643**;
25+
**30/222** clusters exceed epsilon_log (single-linkage chaining — see Unverified).
26+
27+
## Inferred
28+
29+
- Multi-timeframe level confluence **does exist** in the corpus and is not rare: 222
30+
clusters, including **2 four-timeframe** clusters and **24 three-timeframe** clusters.
31+
- The structure is dominated by the **denser timeframes**: `1d,4h` alone accounts for 143/222
32+
(64%). This is expected — 4h has 365 fibs and 1d has 67, so they produce the most level
33+
rows and the most chances to coincide. Higher-TF participation (1M/1w) is rarer and
34+
therefore more notable when it appears.
35+
- Confluence concentrates around known structural inflections (2021 cycle top region
36+
~29k; 2022–23 bottom region ~21k; 2017 early lows ~970), consistent with the corpus
37+
capturing the same swings at multiple resolutions.
38+
39+
## Unverified
40+
41+
- **Chaining:** clusters are connected components (single-linkage). 30/222 have
42+
price_span_log > epsilon_log because rows link transitively via intermediate members,
43+
so a cluster's full band can exceed 0.5%. This is reported (`price_span_log`), not hidden;
44+
whether to switch to a fixed-band (complete-linkage) definition is a **Checkpoint 2**
45+
sensitivity question, not a CP1 decision.
46+
- **Robustness to epsilon:** whether the 222 count and the strong clusters survive at other
47+
epsilon values — deliberately deferred to CP2 (no tuning here).
48+
- Whether high-TF clusters (1M present) are structurally meaningful vs coincidental — this
49+
is a confluence *count*, not a claim about price behavior.
50+
51+
---
52+
53+
## Confluence definition
54+
55+
For every active source fib, each of its 6 stored levels (`ratio ∈
56+
{0, 0.382, 0.5, 0.618, 0.786, 1}`) becomes a **level row** at `log(price)`, with the fib's
57+
anchor time-window `[min(anchor_a,anchor_b), max(...)]`. Two level rows are **connected**
58+
iff `|Δlog_price| ≤ epsilon_log` **and** their anchor windows overlap. A **confluence
59+
cluster** is a connected component spanning **≥2 distinct timeframes**. This is *not* the
60+
segment IoU of [`overlap_detector`](btc-4h-overlap-candidates-20260615.md) — that boxes the
61+
`anchor_a→anchor_b` segment; here we cluster the horizontal level prices.
62+
63+
## Epsilon policy
64+
65+
- Primary threshold **chosen before results: `epsilon_log = 0.005`** (≈0.5% in price),
66+
as specified for CP1. Not tuned to produce clusters.
67+
- Multi-epsilon sensitivity is **Checkpoint 2**, deliberately excluded here.
68+
69+
## Count results
70+
71+
- Level rows: **2772** (from 462 fibs). Clusters (≥2 TF): **222**.
72+
73+
### Breakdown per timeframe combination
74+
75+
| Timeframes | Clusters |
76+
|------------|---------:|
77+
| 1d,4h | 143 |
78+
| 1w,4h | 30 |
79+
| 1w,1d,4h | 16 |
80+
| 1M,4h | 13 |
81+
| 1M,1w | 4 |
82+
| 1w,1d | 4 |
83+
| 1M,1w,4h | 4 |
84+
| 1M,1d,4h | 3 |
85+
| 1M,1d | 2 |
86+
| **1M,1w,1d,4h** | **2** |
87+
| 1M,1w,1d | 1 |
88+
| **Total** | **222** |
89+
90+
By timeframe-count: 4-TF = **2**, 3-TF = **24**, 2-TF = **196**.
91+
92+
### Top clusters (deterministic order: tf_count desc, level_count desc, span asc, …)
93+
94+
| id | TFs | timeframes | levels | price band | span_log | time window |
95+
|----|----:|-----------|------:|------------|---------:|-------------|
96+
| c001 | 4 | 1M,1w,1d,4h | 4 | 29247–29283 | 0.00123 | 2021-01-21 → 2021-06-01 |
97+
| c002 | 4 | 1M,1w,1d,4h | 4 | 21092–21225 | 0.00627 | 2022-12-29 → 2023-07-01 |
98+
| c003 | 3 | 1w,1d,4h | 6 | 972–982 | 0.00975 | 2016-12-29 → 2017-03-04 |
99+
| c004 | 3 | 1M,1w,1d | 5 | 64829 | 0.0 | 2020-03-12 → 2021-06-01 |
100+
| c005 | 3 | 1M,1w,4h | 5 | 47638–48002 | 0.00762 | 2021-01-21 → 2021-06-01 |
101+
| c006 | 3 | 1w,1d,4h | 4 | 13764 | 0.0 | 2019-05-12 → 2020-03-12 |
102+
| c007 | 3 | 1w,1d,4h | 4 | 9085 | 0.0 | 2019-07-04 → 2019-07-17 |
103+
| c008 | 3 | 1w,1d,4h | 4 | 11429–11430 | 0.00008 | 2019-07-04 → 2019-07-17 |
104+
| c009 | 3 | 1M,1d,4h | 4 | 30998–31136 | 0.00445 | 2022-04-01 → 2022-11-01 |
105+
| c010 | 3 | 1M,1w,4h | 4 | 39556–39791 | 0.00591 | 2021-01-21 → 2021-06-01 |
106+
107+
### Example rows (members)
108+
109+
- **c001** (4-TF, ~29274): `fib_..._1M_20210401T000000` · `_1w_20210121T000000` ·
110+
`_1d_20210127T000000` · `_4h_20210126T200000` (ratios 0.0/1.0 — anchor endpoints
111+
coinciding across all four TFs near $29.3k, Jan–Jun 2021).
112+
- **c002** (4-TF, ~21167): `fib_..._1M_20230101T000000` · `_1w_20221229T000000` ·
113+
`_1d_20230107T000000` · `_4h_20230312T120000` (ratios 0.382/0.618, late-2022 bottom region).
114+
115+
Full member lists (summarized at 8 ids) in the committed CSV; unabridged level rows in the
116+
gitignored `experiments/review/mtf_confluence/btc-mtf-levels.csv`.
117+
118+
---
119+
120+
## What this shows
121+
122+
- MTF level confluence **is present and structured**, not absent — the corpus is usable as
123+
a multi-resolution map at the structural level (counts only).
124+
- The strongest confluences land at recognizable cycle inflections and include rare
125+
all-four-timeframe agreements (c001, c002).
126+
127+
## What this does NOT show
128+
129+
- **No** trading signal, edge, support/resistance strength, or predictive claim — these are
130+
geometric coincidences of human-drawn levels, nothing more.
131+
- **No** robustness claim: the count is at a single epsilon; chaining inflates some bands.
132+
- **No** visual confirmation (deferred to CP3, conditional).
133+
- Confluence count is biased toward dense timeframes (1d/4h) by construction.
134+
135+
---
136+
137+
## Stop/Go → Checkpoint 2
138+
139+
**GO.** Meaningful multi-TF clusters exist (222; 2×4-TF, 24×3-TF) — well above the
140+
"near-zero / all-noise → stop" bar. Proceed to **Checkpoint 2 (sensitivity/robustness)**:
141+
re-run at 2–3 epsilon values + test a complete-linkage (fixed-band) cluster definition to
142+
measure how cluster counts and the strong clusters move, and whether chaining (30/222 over
143+
epsilon) materially changes the picture. Still no chart, no tuning-to-fit, no trading
144+
conclusions. Visual atlas (CP3) remains conditional on CP2.
145+
146+
## Verification
147+
148+
- Counts re-derived on disk (sidecar-excluded); `flatten_levels` loads 462 fibs / 2772 rows.
149+
- Superseded `fib_BTC-USD_4h_20250506T080000` absent on disk → not in level rows.
150+
- New module stdlib-only; 10 unit tests (flatten, sidecar-exclusion, no-mutation, proximity,
151+
time-overlap, cross-TF requirement, deterministic ordering, CSV header stability).
152+
- No source labels changed; committed table is text CSV under `docs/`; large levels CSV is
153+
gitignored under `experiments/review/mtf_confluence/`.
154+
155+
## Links
156+
157+
- [next-research-plan](btc-source-fib-next-research-plan-20260615.md) · [corpus-integrity](btc-source-fib-corpus-integrity-20260615.md)
158+
- [committed confluence CSV](btc-mtf-confluence-table-20260615.csv)
159+
- [overlap detector (segment-based, different question)](btc-4h-overlap-candidates-20260615.md)

0 commit comments

Comments
 (0)