kestrel-chartkitv0.49.0

← All examples

range_filter

Range Filter: a line that follows the close only when it leaves a band of mult times the double-smoothed …

range_filter

examples/site_showcase.rs
// Range Filter: a line that follows the close only when it leaves a band of `mult` times the double-smoothed absolute close-to-close change (extras `upper`, `lower`, `direction`). The direction is the sign of the line's last move beyond a relative 1e-9 and starts at 0. Published from bar 2.
// Defaults of "range_filter" (see the indicator reference)
let params = HashMap::from([
    ("mult".to_string(), 3.0),
    ("period".to_string(), 100.0),
]);
let mut indicator = build_checked("range_filter", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Range Filter: a line that follows the close only when it leaves a band of `mult` times the double-smoothed absolute close-to-close change (extras `upper`, `lower`, `direction`). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.Range Filter: a line that follows the close only when it leaves a band of `mult` times the double-smoothed absolute close-to-close change (extras `upper`, `lower`, `direction`). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.
  • Moving averages, bands and trend lines
  • unit: Price