kestrel-chartkitv0.33.0

← All examples

ema

Exponential Moving Average

ema

examples/site_showcase.rs
// Exponential Moving Average (build_typed accepts init=first_sample|sma for the seed; first_sample is the default)
// Defaults of "ema" (see the indicator reference)
let params = HashMap::from([
    ("period".to_string(), 20.0),
]);
let mut indicator = build_checked("ema", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Exponential Moving Average (build_typed accepts init=first_sample|sma for the seed; first_sample is the default). 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.Exponential Moving Average (build_typed accepts init=first_sample|sma for the seed; first_sample is the default). 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