feat(patterns): add the Harmonic Patterns family (8 XABCD detectors) (#169)
## Summary Adds a new **Harmonic Patterns** indicator family (counter 359 → 367, families 22 → 23) — the second half of the A4 roadmap item, following the Chart Patterns family in #166. Eight Fibonacci-ratio detectors built on the shared swing-pivot tracker (`indicators::pattern_swing`) plus two new helpers there — `xabcd` (reads the last five pivots as X-A-B-C-D) and `ratios_in` (checks a list of `(value, low, high)` Fibonacci windows in one expression, no multi-line `&&` coverage gaps). Each consumes candles and emits the uniform pattern sign convention — `+1.0` bullish (terminal point D a swing low), `-1.0` bearish (D a swing high), `0.0` otherwise, never `None`. Parameter-free, with the Fibonacci windows documented as constants per detector. ## Detectors | Indicator | Defining ratio | |-----------|----------------| | `Abcd` | four-point AB=CD (BC retraces AB, CD ≈ AB) | | `Gartley` | AD/XA ≈ 0.786 | | `Butterfly` | AD/XA ∈ 1.27–1.618 (extended D) | | `Bat` | AD/XA ≈ 0.886, shallow B | | `Crab` | AD/XA ≈ 1.618 (deepest D) | | `Shark` | expansion AB, AD/XA 0.886–1.13 | | `Cypher` | BC on XA, CD/XC ≈ 0.786 | | `ThreeDrives` | two symmetric extension drives | ## Touchpoints Core modules + `FAMILIES` group/assert, crate root re-exports, Python/Node/WASM bindings via the candle-pattern macros (Node `index.d.ts`/`index.js` regenerated), the candle fuzz target (`// --- Harmonic Patterns ---` section), Python reference + `CANDLE_SCALAR` registry tests and the Node candle-scalar factory, README catalogue counter + banner cache-buster + family table row + family-count word, `docs/README.md` counter, and the changelog. ## Verification - `cargo test -p wickra-core --lib` — 2966 passed - `cargo test -p wickra-core --doc` — 335 passed - `cargo clippy --workspace --all-targets --all-features -- -D warnings` — clean - Node `npm run build && npm test` — 444 passed - Python `maturin develop --release` + `pytest` — 748 passed Every detector branch is unit-tested, including a bullish and a bearish match per pattern to cover both output arms, plus an out-of-ratio non-match. Fibonacci windows use standard harmonic-trading ranges with documented tolerance bands.
This commit is contained in:
@@ -10026,6 +10026,14 @@ node_candle_pattern!(WedgeNode, wc::Wedge, "Wedge");
|
||||
node_candle_pattern!(FlagPennantNode, wc::FlagPennant, "FlagPennant");
|
||||
node_candle_pattern!(RectangleRangeNode, wc::RectangleRange, "RectangleRange");
|
||||
node_candle_pattern!(CupAndHandleNode, wc::CupAndHandle, "CupAndHandle");
|
||||
node_candle_pattern!(AbcdNode, wc::Abcd, "Abcd");
|
||||
node_candle_pattern!(GartleyNode, wc::Gartley, "Gartley");
|
||||
node_candle_pattern!(ButterflyNode, wc::Butterfly, "Butterfly");
|
||||
node_candle_pattern!(BatNode, wc::Bat, "Bat");
|
||||
node_candle_pattern!(CrabNode, wc::Crab, "Crab");
|
||||
node_candle_pattern!(SharkNode, wc::Shark, "Shark");
|
||||
node_candle_pattern!(CypherNode, wc::Cypher, "Cypher");
|
||||
node_candle_pattern!(ThreeDrivesNode, wc::ThreeDrives, "ThreeDrives");
|
||||
|
||||
// ============================== Microstructure: Order Book ==============================
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user