squeeze_momentum
Volatility squeeze with a linear-regression momentum: the endpoint of the least-squares line through the cl…
squeeze_momentum
examples/site_showcase.rs// Volatility squeeze with a linear-regression momentum: the endpoint of the least-squares line through the close's distance to the mean of the window midrange and its average (a price difference, extra `squeeze` +1 on, -1 off, 0 between). The Bollinger bands use bb_mult and the Keltner channel kc_mult. Published from bar max(2 * kc_length - 1, length).
// Defaults of "squeeze_momentum" (see the indicator reference)
let params = HashMap::from([
("bb_mult".to_string(), 2.0),
("kc_length".to_string(), 20.0),
("kc_mult".to_string(), 1.5),
("length".to_string(), 20.0),
]);
let mut indicator = build_checked("squeeze_momentum", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}