Double-bottom detector (experimental) and a --patterns switch for the replay - #127
Merged
Merged
Conversation
…or the replay detect_double_bottom: two consecutive swing lows within 3 %, the rally between them at least 10 % and 2 ATR above the higher low, a prior decline or SMA50 < SMA200, a close above the peak as the trigger, stop under the second low, target one height above the entry, and the H&S's age lag, volume, risk and listing limits. PATTERN_DETECTORS holds every detector, ACTIVE_PATTERNS what the nightly scan runs; the report and meta iterate the active set. The backtest gains --patterns (cup, ihs, wolfe, db) and the workflow a patterns input. Fixture, tests (164: levels from the notes, single-rule mutations, isolation, a 200-random-walk false-positive rate), wiki 02, 03 and 04, README, changelog. Co-Authored-By: Claude Fable 5.1 <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.
Summary
The first candidate pattern since the cup went watch-only: a double-bottom detector, built on the inverse head and shoulders template, kept out of the nightly scan until it passes the replay gate (#126).
Detector
detect_double_bottomevaluate_breakout, floor the second low); stop under the second low, the pattern's invalidation, like the H&S right shoulder; target one height (peak minus the lower low) above the entry; the H&S's age lag (the second low is a swing low, visible five bars later), volume rule, risk cap and listing limit.tuned's floor keeps only the higher-second-low form; the replay measures both.Plumbing
PATTERN_DETECTORSholds every detector by name;ACTIVE_PATTERNSis what the nightly scan runs (unchanged: cup, H&S, Wolfe) and what the report andmetaiterate. The double bottom is registered but not active.tools/backtest.py --patterns cup,ihs,wolfe,db(or the full names) replays any subset; the workflow gains thepatternsinput; the JSON records the patterns run.Tests (164): levels recomputed from the notes and the documented formulas, single-rule mutations rejected (lows too far apart, rally under 10 %, lows too close in time, nothing to reverse), isolation (not in
DETECTORS, the other fixtures are not W's and the W is not an H&S or a cup), the controls and the 200-random-walk rate, and--patternsparsing and selection end to end.Docs: wiki 02 (the pattern's section, marked experimental), wiki 03 (its constants, the
--patternsswitch), wiki 04, README (the pattern table), changelog.Replay: the eleven yearly point-in-time runs are dispatched from this branch with
patterns=cup,ihs,wolfe,db, plus a second set withMIN_REWARD_RISK=None; the result and the decision go on #126. Merging this PR changes nothing in the nightly scan.Test plan
testsworkflow and the backtest smoke run on this PR🤖 Generated with Claude Code