kestrel-chartkitv0.49.0

← All examples

kestrel_adaptive_smoother

Kestrel Adaptive Smoother: a cascade of exponential stages whose gain follows how directed and how unusual …

kestrel_adaptive_smoother

examples/site_showcase.rs
// Kestrel Adaptive Smoother: a cascade of exponential stages whose gain follows how directed and how unusual the recent movement is, so the line rests in back-and-forth movement and follows a real move. Purpose: a fixed average sits at one point between lag and noise; this one moves that point bar by bar, without the negative weights that make a fixed filter overshoot. Use: a reference or trailing line, context for the side of a swing, or the centre of a band that turns price against the line into a state with memory (enter beyond the band, release at the line). Caveat: it stays closer to the price at turns than a fixed average with as many direction changes, on random walks just as on prices, so this is a property of the construction and no forecast of direction; like every line near the price it is crossed often in sideways movement, and a crossing alone is no signal (see the adaptive smoother guide)
// Defaults of "kestrel_adaptive_smoother" (see the indicator reference)
let params = HashMap::from([
    ("adapt".to_string(), 0.5),
    ("period".to_string(), 20.0),
    ("phase".to_string(), 0.5),
]);
let mut indicator = build_checked("kestrel_adaptive_smoother", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Kestrel Adaptive Smoother: a cascade of exponential stages whose gain follows how directed and how unusual the recent movement is, so the line rests in back-and-forth movement and follows a real move. 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.Kestrel Adaptive Smoother: a cascade of exponential stages whose gain follows how directed and how unusual the recent movement is, so the line rests in back-and-forth movement and follows a real move. 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