kestrel-chartkitv0.49.0

← All examples

reflex

Ehlers' Reflex: the deviation of a SuperSmoother

reflex

examples/site_showcase.rs
// Ehlers' Reflex: the deviation of a SuperSmoother (period length / 2) from the line through its value `length` bars ago, normalised by its root mean square; published from bar length + 1. The SuperSmoother starts from the first two closes (Ehlers' listing from 0), and a sum within rounding of zero counts as 0. The coefficients use pi in full, where Ehlers' listings truncate it to 3.14159 in the exponent.
// Defaults of "reflex" (see the indicator reference)
let params = HashMap::from([
    ("length".to_string(), 20.0),
]);
let mut indicator = build_checked("reflex", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Ehlers' Reflex: the deviation of a SuperSmoother (period length / 2) from the line through its value `length` bars ago, normalised by its root mean square; published from bar length + 1. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 12 alerts in view, the latest as markers.Ehlers' Reflex: the deviation of a SuperSmoother (period length / 2) from the line through its value `length` bars ago, normalised by its root mean square; published from bar length + 1. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 12 alerts in view, the latest as markers.
  • Oscillators
  • unit: Unitless