Repository navigation
J-KAUFMANSTOP-DIST — distance to Kaufman's stop, long (22, mult 2) - #352
Merged
Merged
Conversation
…fmanstop_dist (trend), Gates A-D, five wiring touch points, tests, docs/JKaufmanstopDistMeasured.md and the review folder. Gate E pending, run by issue-solver. Refs #124 J_KAUFMANSTOP_DIST_22_2.0 = (close - stop)/close, where the stop sits twice the 22-bar average range below the bar's OWN low: rng[T] = high[T] - low[T] avg[T] = mean(rng[T-21..T]) SMA 22 stop[T] = low[T] - 2 * avg[T] 22 and 2 are module constants, not arguments: the issue's quote and the screen prototype spell exactly those two, and that pair is the whole of what the 2026-10-24 screen measured at Gate E. THE SCREEN PROTOTYPE IS THIS COLUMN'S ARITHMETIC, BIT FOR BIT, and that is the first thing to read because it is the opposite of #122. A3 measures the two bit-equal on all nine test frames; the prototype is readable here (docs/issues/screen/ind_screen_r2.py:127, with ind_screen.py:47's mean(x, n) = x.rolling(n).mean(), the same call `sma` makes). So the screen's DISCLOSE_GAP figures describe THIS arithmetic rather than a neighbouring column -- on 89 real frames and through an engine this worktree can neither read nor run, so the port's own Gate E run still decides the band. Gate A also runs the formula two further ways. A bar-by-bar oracle with its own naive 22-term window sum over plain Python floats, sharing no code with the module, is BIT-EQUAL on 1,479 of 1,479 fired bars of each of six varying frames; pandas' compensated rolling.mean() is itself bit-equal to that naive sum on the walk frame, measured rather than assumed. TA-Lib spells it third: (close - (low - 2*talib.SMA(high - low, 22)))/close is bit-equal on all six at Spearman 1.0000, and talib.SMA, this module's `sma` and the column all first fire at bar 21. The tests assert 1e-12/1e-9 rather than the bit-equality, because the frames are built with np.exp/np.cumsum. MIN_BARS IS PERIOD, NOT PERIOD + 1, which is the one structural number that differs from j_chandelier_dist: nothing here reads a previous close, so the SMA's input is defined at bar 0. Four readings are priced rather than assumed close: SMA22 over the TRUE range (1,478 of 1,479 bars, up to 5.6e-02, Spearman 0.279 .. 0.534, and it fires a bar later), EMA22 (1.3e-03), the stop off YESTERDAY's low (up to 3.2e-01 at Spearman -0.075 .. 0.020) and `high - low` through the fork's non_zero_range -- which is bit-equal at a price level of 100 even on 215 tied bars, so the plain subtraction buys nothing there, and fails Gate D's x8 and x64 cells at 1e-6, where this module holds. Nothing here claims what jesse's CODE says: the library is not installed, web access is unavailable, and a test records that so the claim cannot rot into "checked against jesse". Even "Kaufman's stop" is attributed to the issue rather than asserted. Gate B is the sweep AND the oracle. The module is caught 0 of 36 offsets on six frames; six look-ahead mutants read off the shipped source are live and caught 36 of 36 on each of three frames, the first catch moving a bar by 1.379e-05 .. 3.023e-02. Three edits that LAG a leg are caught 0 of 36 by the sweep and all three by the oracle, by 6.152e-04 .. 3.224e-01. The backward direction is measured too: truncating at bar 500 leaves all 979 later bars bit-equal. Gate C/D: 1,479 of 1,500 bars on each of nine frames, 1,479 distinct values on each of the six varying ones, 0.005961 .. 0.014415 pooled. THE COLUMN DOES NOT CHANGE SIGN, which is where it parts from both sibling stop distances -- (close - stop)/close = (close - low)/close + 2*avg/close, two non-negative terms on well-formed OHLC -- so the signal is the SIZE: 8,874 of 8,874 bars positive, 0 exactly zero. x8/x64 bit-identical on all nine frames and on all nine at each of 1e-6, 1e+6 and 1e+100 (54 cells), the largest of the chain's ten series at 1e100 being 9.776e+101 against DBL_MAX, 1.839e+206 of headroom; x10/x3.7/x0.1/x1.0000001 within 5.160e-14, asserted 1e-9. A +10 level shift moves all 1,479 fired bars of the six varying frames and 0 of the flat frame's, which is pinned separately. A BAD PRICE EMPTIES A BOUNDED WINDOW AND MOVES NOTHING AFTER IT: a NaN, +inf or -inf high or low blanks exactly bars max(T, 21) .. min(T+21, n-1) -- 22 in mid-frame, 5 at bar 1,495, 6 at bar 5 -- and a bad close blanks its own bar, or none inside the warm-up. 45 cells, and 0 later bars moved in every one. The opposite of #122, where a bad low blanked nothing and moved 400 .. 658 bars, and the reason is structural: no recursion here. THREE OF THE FIVE GUARDS ARE MEASURED DEAD CODE and the receipt says so rather than claiming a load they do not carry -- the finding that cost this run two MAJORs. The three input finite guards are bit-equal no-ops in all 42 guard-off cells measured, and they stay no-ops even with `sma` rebound to a mean that PROPAGATES an infinity (G5). What absorbs a bad high or low is pandas turning an infinite observation into a NaN before a rolling aggregation sees it -- measured on three aggregations, mechanism NOT claimed since pandas is outside this worktree -- and two tests would fail if that went, not one: the ..._into_nan one and test_route_1_never_reaches_the_output, whose zero becomes 99 of 120 under a propagating mean. What does bite is the close-is-positive guard (without it a close of -50 ships 1.924 among bars of 0.006 .. 0.014) and the final finite mask (two of three overflow routes reach the output without it, 99 of 120 each). In-fork overlap (SYNTHETIC, a disclosure and not a gate) reads LOW here, the reverse of #122: nearest is a retyped lean_avgrange_14 at a per-frame median 0.5506, then j_chandelier_dist 0.1436, a retyped Stop_2ATR_pct 0.1366, a retyped true_range/close 0.1096 and natr:NATR_14 0.1092 -- and natr, the one comparator with both figures, is 0.75 BELOW the screen's 0.8611. On these frames the wick term carries more of the column than the range term does (|rho| 0.857 .. 0.884 against 0.574 .. 0.620), so L cannot stand in for Gate E in either direction. THE NEAREST CANDIDATE OF THIS COLUMN'S OWN FAMILY WAS STRUCK, and that is Gate E context no reading of the synthetic figures would give: lean_avgrange_14, SMA(H - L, 14)/close, paired at 0.8646 with this candidate and measured 0.9489 vs natr over n = 397,692 -- dropped, "Gate E STRUCK" (candidates_r2.csv). The screen kept this candidate at 0.8776 and dropped that one at 0.9489 on the same comparator, so the margin is the wick term plus the x2. Earlier drafts of the receipt had this inverted, as a port to go measure later. FOUR Fletcher review rounds, 30 findings, every one applied, and NOT ONE about the mathematics: every reviewer re-ran both measurement scripts section by section on both numpy dispatches and reported every cell reproducing, plus the three suite counts to the line. The arc is one defect repeating -- a count or a mechanism written past the run, inside the fix for the previous round's: one cell versus eight (r1), one test versus two (r2), a refuted vehicle left in place and "the three identical-dispatch lines" over twelve of them (r3), _prep_values left standing in two of six places and the inverted screen verdict (r4). Even the corrections were not immune: the replacement count for r3 came out eleven from a single-line grep that missed a wrapped sentence. Three habits came out of it and are in the files: count with a tool then state the number; measure the hypothetical instead of reasoning about it (G5 refuted r2's proposed mechanism and confirmed its conclusion by the right vehicle); and scope a universal to the cells that ran. Round 4 was the loop's last round, so its seven fixes have no post-fix review: there are no open findings and also no PASS, and docs/reviews/auto-2026-11-19-j-kaufmanstop-dist/99-summary.md says so instead of implying one. Gate E owed: no ledger row, and tests/test_j_kaufmanstop_dist.py asserts there is none, which is the receipt session's cue. Gate C's real-data limb is owed from the same run; everything here is synthetic. Gate F: 380 tests for the module, the same 380 under NPY_DISABLE_CPU_FEATURES="AVX512F AVX512_SKX AVX2 FMA3" (via docs/measure_j_kaufmanstop_dist_cpu.py, which prints the dispatchable features still enabled and refuses to run if any of the four survived); with tests/test_gate_e_ledger.py, 1,478 passed and 1 failed, the owed row naming ['j_kaufmanstop_dist'] and nothing else; full suite 2 failed, 12,496 passed, 86 skipped -- that owed row and the AlternativeRepos-dependent talib CSV test that CI deselects by name. The parent repo's suite is the launcher's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…t (DISCLOSE_GAP, 0.8776 vs natr, n = 396,980, per-frame max median 0.8601 over 89 frames), fill Gate C's real-data limb (396,980 non-NaN and 396,980 non-zero of 398,849), and swap the two pending-Gate-E tests for three that pin the recorded row. Refs #124 The launcher ran gate_e_overlap.py run --module pandas_ta.trend.j_kaufmanstop_dist on the code at c39dcf8; outputs is124-j_kaufmanstop_dist-2d508b6b, recorded into docs/gate_e_ledger.csv by docs/gate_e_ledger.py record --measured 2026-11-20, which printed `j_kaufmanstop_dist:J_KAUFMANSTOP_DIST_22_2.0 DISCLOSE_GAP 0.8776 vs natr`. DISCLOSE_GAP on both limbs of r3-perframe-0.90, so the column SHIPS with the disclosure and nothing is removed: pooled max |rho| 0.8776182137043913 vs compute_all's natr over n = 396,980, top-five per-frame max median 0.8600682984579084 against the same comparator over 89 frames, verdict_pooled_only the same, 687 comparators with squeeze_SQZ_NO dropped as constant -- the comparator fault c22_ami_timescale, j_acosc, j_safezone_dist and j_chandelier_dist dropped too. A DISCLOSE_GAP row needs no waiver, so the waiver column is empty and the new test asserts that. THE RUN AGREES WITH THE SCREEN PROTOTYPE TO 15 SIGNIFICANT DIGITS -- 0.8776182137043913 against 0.8776182137043917, same comparator, same n, same per-frame figure digit for digit -- which is what section A3's bit-equality predicted, and the receipt's new section E2 reads it out rather than leaving it to a reader. Because an expected agreement is the easiest row to copy over from the wrong run, the replacement test pins the run id and not only the arithmetic. Section E2 also closes the four things the pre-run draft said the screen's figure did not settle; the fourth stays OPEN and says so: what the engine computes under the name natr is still not readable here, and that natr and Stop_2ATR_pct are monotone transforms of each other is an inference from their identical Spearman columns, not from their code. THE DISCLOSURE IS THE POINT OF THE ROW, and the receipt and docs/MLCompanionContract.md both carry it now: natr and the manifest's Stop_2ATR_pct tie this column at 0.8776 pooled to every printed digit, 7 of 89 frames reach |rho| 0.90 individually (max 0.9150) and 82 of 89 sit at 0.80 or above, so a miner fed this column and a normalised ATR double-weights one volatility signal. The first comparator outside that family is Swing_Range_pct, 0.147 lower at 0.7305. The nearest candidate of the same screen round, lean_avgrange_14, was STRUCK at 0.9489 vs natr -- this column came within 0.071 of it and sits 0.022 under the strike line. Gate C's real-data limb is measured rather than owed: 396,980 of 398,849 pooled BIST bars non-NaN, and the SAME 396,980 non-zero, so 0 real fired bar reads exactly 0.0 -- the real-data limb of the no-sign-change structure section C1 measures synthetically. 398,849 - 396,980 = 1,869 = 89 x the 21-bar warm-up, and the receipt states that as a recounted identity between two of the run's numbers rather than as a per-frame measurement it did not make. Section L is re-read against the run instead of being left as written: three of its rows now have a real figure, and the synthetic ones are 0.72 .. 0.77 below them (natr 0.1092 vs 0.8776, Stop_2ATR_pct 0.1366 vs 0.8776, Swing_Range_pct 0.0094 vs 0.7305). Its "a range-based comparator can only reach so far" is refuted as a statement about real frames and kept as one about those six; which of the two terms carries the real overlap is measured nowhere and the receipt says so. pandas_ta/trend/j_kaufmanstop_dist.py is deliberately NOT edited, so its docstring still reads "Gate E ... It is PENDING": the ledger pins module_sha1 c833e200 to the bytes the harness imported and tests/test_gate_e_ledger.py::test_row_still_describes_its_module re-derives it, so fixing the paragraph would invalidate the measurement it describes. Section E1 and the later-session list disclose that and tell the next session to fix it in the same change as any other edit to that file. README.md and docs/IndicatorDictionary.md name the column in generated lists only. Tests: tests/test_j_kaufmanstop_dist.py 381 passed (380 before, -2 pending tests +3 that pin the ledger row, the receipt's copy of the numbers and the real-data counts), the same 381 under NPY_DISABLE_CPU_FEATURES="AVX512F AVX512_SKX AVX2 FMA3" via docs/measure_j_kaufmanstop_dist_cpu.py; with tests/test_gate_e_ledger.py, 1,495 passed, so the owed-row failure is gone. Full suite 1 failed, 12,709 passed, 86 skipped in 417 s -- the AlternativeRepos- dependent talib CSV test that CI deselects by name, and nothing else. The parent repo's suite is the launcher's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #124
Opened by issue-solver, a headless run; the owner merges. The launcher's code checked the paths, both repos' suites and Gate E. A fresh review gate returned PASS on
9a3ad1b642e3in round 1 of 3.Gate (round 1)
Launcher checks
9a4af209, PYTHONPATH = PandasTa): base 2022 passed, 32 failed, 4 errors, 15 skipped; HEAD 2022 passed, 32 failed, 4 errors, 15 skipped; regressions 0.pandas_ta.trend.j_kaufmanstop_dist (
is124-j_kaufmanstop_dist-2d508b6b):/brutally-honest-review --autorun folders:docs/reviews/auto-2026-11-19-j-kaufmanstop-dist/./home/tolga/.issue-solver/runs/20261120-060217-124.🤖 Generated with Claude Code