relative_momentum_index
Relative Momentum Index: the RSI form over the change across momentum bars instead of one, Wilder-average…
relative_momentum_index
examples/site_showcase.rs// Relative Momentum Index: the RSI form over the change across `momentum` bars instead of one, Wilder-averaged over `length` from the first change; 0 to 100, equal to the RSI with momentum 1. Published from bar momentum + length.
// Defaults of "relative_momentum_index" (see the indicator reference)
let params = HashMap::from([
("length".to_string(), 20.0),
("lower".to_string(), 30.0),
("momentum".to_string(), 5.0),
("upper".to_string(), 70.0),
]);
let mut indicator = build_checked("relative_momentum_index", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}