pub struct PivotDivergenceEngine { /* private fields */ }Expand description
Enhanced Pivot-based Divergence Detection Engine across Price and Oscillator anchors.
Ranks divergence candidates: each confirmed pivot is compared against up to
PivotDivergenceEngine::with_max_prior_pivots prior same-type pivots (not just the
immediately preceding one), each candidate is scored by DivergenceEvent::quality_score,
and only the single highest-scoring bullish and bearish candidate per confirmation is emitted
— the conflict resolution the plain “compare against the last pivot only” version lacked.
Implementations§
Source§impl PivotDivergenceEngine
impl PivotDivergenceEngine
pub fn new(lookback: usize) -> Self
pub fn with_confirmation( left_bars: usize, right_bars: usize, min_distance: usize, max_distance: usize, ) -> Self
Sourcepub fn with_max_prior_pivots(self, max_prior_pivots: usize) -> Self
pub fn with_max_prior_pivots(self, max_prior_pivots: usize) -> Self
How many prior same-type pivots to keep and rank divergence candidates against (beyond just the immediately preceding one). Default 5.
Sourcepub fn with_oscillator_anchor(self, anchor: OscillatorAnchor) -> Self
pub fn with_oscillator_anchor(self, anchor: OscillatorAnchor) -> Self
How a pivot candidate’s oscillator value is anchored. Default
OscillatorAnchor::WindowExtreme.
Sourcepub fn update(&mut self, bar: &Bar, oscillator: f64) -> Vec<DivergenceEvent>
pub fn update(&mut self, bar: &Bar, oscillator: f64) -> Vec<DivergenceEvent>
Returns events only after right_bars have confirmed the candidate pivot.
pub fn reset(&mut self)
Trait Implementations§
Source§impl Clone for PivotDivergenceEngine
impl Clone for PivotDivergenceEngine
Source§fn clone(&self) -> PivotDivergenceEngine
fn clone(&self) -> PivotDivergenceEngine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more