kestrel-chartkitv0.49.0

← All examples

roofing_filter

Ehlers' Roofing Filter: a two-pole high-pass filter

roofing_filter

examples/site_showcase.rs
// Ehlers' Roofing Filter: a two-pole high-pass filter (cutoff hp_period) followed by a SuperSmoother (lp_period); an oscillator around 0 on the price scale, published from the hp_period-th bar. The high-pass is 0 on the first two bars and the SuperSmoother starts from it. The coefficients use pi in full, where Ehlers' listings truncate it to 3.14159 in the exponent.
// Defaults of "roofing_filter" (see the indicator reference)
let params = HashMap::from([
    ("hp_period".to_string(), 48.0),
    ("lp_period".to_string(), 10.0),
]);
let mut indicator = build_checked("roofing_filter", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Ehlers' Roofing Filter: a two-pole high-pass filter (cutoff hp_period) followed by a SuperSmoother (lp_period); an oscillator around 0 on the price scale, published from the hp_period-th bar. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 6 alerts in view, the latest as markers.Ehlers' Roofing Filter: a two-pole high-pass filter (cutoff hp_period) followed by a SuperSmoother (lp_period); an oscillator around 0 on the price scale, published from the hp_period-th bar. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 6 alerts in view, the latest as markers.
  • Oscillators
  • unit: Unitless