kestrel-chartkitv0.49.0

← All examples

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", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
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. 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.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. 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.
  • Oscillators
  • unit: Ratio