Skip to content

feat: backtest features from the second review, and a 1.25-ATR stop variant - #111

Merged
yanivil merged 2 commits into
mainfrom
feat/backtest-review2-features
Sep 8, 2026
Merged

yanivil merged 2 commits into
mainfrom
feat/backtest-review2-features

Conversation

@yanivil

@yanivil yanivil commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

Description

The testable remainder of the second external review (2026-09-08), recorded as replay features under the protocol of docs/wiki/03, then tested over the same eleven years. No rule changes.

  • Six features on every replay row and in the outcome-by-feature table: the pattern's depth in ATR (cup bottom to right rim, shallower shoulder to head, Wolfe point 1 to point 5); the breakout bar's close within its own range; whether that close cleared the prior bar's high; the breakout volume z-score against the prior 20 bars; and for cups the handle's mean volume over the cup's and the slope of the handle's volume as a fraction of its mean per bar.
  • Grid: an extra 1.0 ATR row, 1.25 ATR under the structural low, so the review's 1.2-ATR stop is scored on the same signals as the others.
  • Wiki 03, new subsection "A second review, tested": what the review proposed, what was already in place, and the ten-year result of every testable item. Changelog.

Results (eleven yearly point-in-time runs from this branch, 34255129970 to 34255999955, the second set with CUP_MIN_ROUNDNESS=0.8; the stop variant on the two-year grid run 34256064869):

Proposal Ten-year result Verdict
Volume z-score of 1.5 as a gate monotone, +0.16 R at or below 0 to +0.34 above 3; the gate keeps 315 of 1630 signals at +0.32 and drops 1315 at +0.20 feature, not gate
Close above the prior bar's high with +0.19 R on 1405; without +0.42 R on 225, positive in 9 of 11 years reversed
Strong close within the bar +0.24, +0.24, +0.21 no effect
Handle volume decay (cups) +0.06, +0.01, +0.06 by ratio; falling slope +0.05, rising +0.01 no effect
Cup R² 0.80 instead of 0.70 cups −0.10 R on 127 against +0.03 on 307; the 180 removed ran +0.12 worse
Pattern depth in ATR at or below 3 ATR +0.26 R with a 42 % hit rate; above 10 ATR +0.26 with 15 % no gate
Stop 1.25 ATR under the low +0.20 R at 49 % against +0.29 at 41 %; same order in both windows worse per trade

Verified: ruff clean, 135 tests pass (new arithmetic checks for every feature on the cup fixture, per-pattern depth for inverse H&S and Wolfe, cup-only features absent elsewhere, 24 grid rows and the new row rendered); a 30-ticker real-data run renders the buckets.

Related Issues

Related: #109 (cups: the roundness and handle-volume results bear on it), #108 (drawdowns), #96 (protocol)

Checklist

  • Code follows existing project style and type annotations
  • Threshold changes include a one-line "why" comment in scan.py (no thresholds changed)
  • Offline unit tests pass (python -m pytest -q)
  • Random-walk false-positive rate stays under 5% (detection logic untouched)
  • Documentation updated in docs/wiki/
  • CHANGELOG.md updated

🤖 Generated with Claude Code

yanivil and others added 2 commits September 8, 2026 20:06
…ariant

Replay rows and the outcome-by-feature table gain the pattern's depth in ATR,
the breakout bar's close within its range and whether it cleared the prior
bar's high, the breakout volume z-score against the prior 20 bars, and for
cups the handle's volume against the cup's and the handle's volume slope.
The stop / target grid gains an extra 1.0 ATR row (1.25 ATR under the
structural low). Recorded to be tested; no rule uses them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… row

Wiki 03 gains "A second review, tested": every proposal with its ten-year
result (runs 34255129970 to 34255999955, the roundness set with
CUP_MIN_ROUNDNESS=0.8, the stop variant on grid run 34256064869). None
improves the system; two would have removed the better half of their
population. The changelog entry states the outcomes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yanivil
yanivil merged commit 812e515 into main Sep 8, 2026
4 of 5 checks passed
@yanivil
yanivil deleted the feat/backtest-review2-features branch September 8, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant