kestrel-chartkitv0.33.0

← All examples

stochastic

Classic Stochastic Oscillator

stochastic

examples/site_showcase.rs
// Classic Stochastic Oscillator
// Defaults of "stochastic" (see the indicator reference)
let params = HashMap::from([
    ("d_period".to_string(), 3.0),
    ("k_period".to_string(), 14.0),
]);
let mut indicator = build_checked("stochastic", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Classic Stochastic Oscillator. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 94 alerts in view, the latest as markers.Classic Stochastic Oscillator. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 94 alerts in view, the latest as markers.
  • Oscillators
  • unit: Ratio