kestrel-chartkitv0.38.0

← All examples

cusum

Two-sided CUSUM of standardized close-to-close returns

cusum

examples/site_showcase.rs
// Two-sided CUSUM of standardized close-to-close returns
// Defaults of "cusum" (see the indicator reference)
let params = HashMap::from([
    ("h".to_string(), 4.0),
    ("k".to_string(), 0.5),
    ("len".to_string(), 20.0),
]);
let mut indicator = build_checked("cusum", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Two-sided CUSUM of standardized close-to-close returns. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.Two-sided CUSUM of standardized close-to-close returns. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.
  • Volatility and trend strength
  • unit: Unitless