kestrel-chartkitv0.49.0

← All examples

narrow_range

Narrowest range of the last period bars

narrow_range

examples/site_showcase.rs
// Narrowest range of the last period bars (NR4, NR7) after Crabel (1990): 1 when the bar's high-low range is strictly smaller than each of the period - 1 bars before it; extra inside marks a bar within the previous bar's range
// Defaults of "narrow_range" (see the indicator reference)
let params = HashMap::from([
    ("period".to_string(), 7.0),
]);
let mut indicator = build_checked("narrow_range", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Narrowest range of the last period bars (NR4, NR7) after Crabel (1990): 1 when the bar's high-low range is strictly smaller than each of the period - 1 bars before it; extra inside marks a bar within the previous bar's range. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 20 alerts in view, the latest as markers.Narrowest range of the last period bars (NR4, NR7) after Crabel (1990): 1 when the bar's high-low range is strictly smaller than each of the period - 1 bars before it; extra inside marks a bar within the previous bar's range. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 20 alerts in view, the latest as markers.
  • Market structure and patterns
  • unit: Ratio