kestrel-chartkitv0.33.0

← All examples

kama

Kaufman's Adaptive Moving Average

kama

examples/site_showcase.rs
// Kaufman's Adaptive Moving Average
// Defaults of "kama" (see the indicator reference)
let params = HashMap::from([
    ("fast_period".to_string(), 2.0),
    ("period".to_string(), 10.0),
    ("slow_period".to_string(), 30.0),
]);
let mut indicator = build_checked("kama", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Kaufman's Adaptive Moving Average. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.Kaufman's Adaptive Moving Average. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.
  • Moving averages, bands and trend lines
  • unit: Price