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", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}