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:
@@ -13683,6 +13683,14 @@ candle_pattern_no_param!(PyWedge, wc::Wedge, "Wedge");
|
||||
candle_pattern_no_param!(PyFlagPennant, wc::FlagPennant, "FlagPennant");
|
||||
candle_pattern_no_param!(PyRectangleRange, wc::RectangleRange, "RectangleRange");
|
||||
candle_pattern_no_param!(PyCupAndHandle, wc::CupAndHandle, "CupAndHandle");
|
||||
candle_pattern_no_param!(PyAbcd, wc::Abcd, "Abcd");
|
||||
candle_pattern_no_param!(PyGartley, wc::Gartley, "Gartley");
|
||||
candle_pattern_no_param!(PyButterfly, wc::Butterfly, "Butterfly");
|
||||
candle_pattern_no_param!(PyBat, wc::Bat, "Bat");
|
||||
candle_pattern_no_param!(PyCrab, wc::Crab, "Crab");
|
||||
candle_pattern_no_param!(PyShark, wc::Shark, "Shark");
|
||||
candle_pattern_no_param!(PyCypher, wc::Cypher, "Cypher");
|
||||
candle_pattern_no_param!(PyThreeDrives, wc::ThreeDrives, "ThreeDrives");
|
||||
// ============================== Microstructure: Order Book ==============================
|
||||
//
|
||||
// Order-book indicators consume a depth snapshot rather than OHLCV. Streaming
|
||||
@@ -18212,5 +18220,13 @@ fn _wickra(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||
m.add_class::<PyFlagPennant>()?;
|
||||
m.add_class::<PyRectangleRange>()?;
|
||||
m.add_class::<PyCupAndHandle>()?;
|
||||
m.add_class::<PyAbcd>()?;
|
||||
m.add_class::<PyGartley>()?;
|
||||
m.add_class::<PyButterfly>()?;
|
||||
m.add_class::<PyBat>()?;
|
||||
m.add_class::<PyCrab>()?;
|
||||
m.add_class::<PyShark>()?;
|
||||
m.add_class::<PyCypher>()?;
|
||||
m.add_class::<PyThreeDrives>()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user