kestrel-chartkitv0.33.0

← All examples

pivot_divergence

Price-pivot-anchored divergence

pivot_divergence

examples/site_showcase.rs
// Price-pivot-anchored divergence (regular and hidden) on a selectable oscillator (0 RSI, 1 WaveTrend, 2 Stoch RSI, 3 Williams %R, 4 CCI); fires on the confirmation bar, extra["pivot_price"] is the pivot (natural stop)
// Defaults of "pivot_divergence" (see the indicator reference)
let params = HashMap::from([
    ("left".to_string(), 7.0),
    ("max_distance".to_string(), 120.0),
    ("max_prior_pivots".to_string(), 5.0),
    ("min_distance".to_string(), 10.0),
    ("oscillator".to_string(), 0.0),
    ("right".to_string(), 7.0),
]);
let mut indicator = build_checked("pivot_divergence", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Price-pivot-anchored divergence (regular and hidden) on a selectable oscillator (0 RSI, 1 WaveTrend, 2 Stoch RSI, 3 Williams %R, 4 CCI); fires on the confirmation bar, extra["pivot_price"] is the pivot (natural stop). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.Price-pivot-anchored divergence (regular and hidden) on a selectable oscillator (0 RSI, 1 WaveTrend, 2 Stoch RSI, 3 Williams %R, 4 CCI); fires on the confirmation bar, extra["pivot_price"] is the pivot (natural stop). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.
  • Market structure and patterns
  • unit: Unitless