kestrel-chartkitv0.33.0

← All examples

rsi

Relative Strength Index

rsi

examples/site_showcase.rs
// Relative Strength Index (build_typed accepts smoothing=wilder|ema for the up/down averages; wilder is the default)
// Defaults of "rsi" (see the indicator reference)
let params = HashMap::from([
    ("avg_len".to_string(), 3.0),
    ("overbought".to_string(), 70.0),
    ("oversold".to_string(), 30.0),
    ("rsi_len".to_string(), 14.0),
    ("sig_len".to_string(), 3.0),
]);
let mut indicator = build_checked("rsi", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Relative Strength Index (build_typed accepts smoothing=wilder|ema for the up/down averages; wilder is the default). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 10 alerts in view, the latest as markers.Relative Strength Index (build_typed accepts smoothing=wilder|ema for the up/down averages; wilder is the default). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 10 alerts in view, the latest as markers.
  • Oscillators
  • unit: Ratio