kestrel-chartkitv0.33.0

← All examples

double_pattern

Double bottom/top as a streaming event: forming on the second pivot

double_pattern

examples/site_showcase.rs
// Double bottom/top as a streaming event: forming on the second pivot (equal level within tolerance_atr, counter-swing ≥ min_depth_atr), confirmed on a close through the neckline; extra: neckline, target (measured move), wick (invalidation, natural stop)
// Defaults of "double_pattern" (see the indicator reference)
let params = HashMap::from([
    ("atr_len".to_string(), 14.0),
    ("max_gap".to_string(), 100.0),
    ("max_wait".to_string(), 50.0),
    ("min_depth_atr".to_string(), 1.5),
    ("pivot_len".to_string(), 5.0),
    ("tolerance_atr".to_string(), 0.5),
]);
let mut indicator = build_checked("double_pattern", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Double bottom/top as a streaming event: forming on the second pivot (equal level within tolerance_atr, counter-swing ≥ min_depth_atr), confirmed on a close through the neckline; extra: neckline, target (measured move), wick (invalidation, natural stop). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.Double bottom/top as a streaming event: forming on the second pivot (equal level within tolerance_atr, counter-swing ≥ min_depth_atr), confirmed on a close through the neckline; extra: neckline, target (measured move), wick (invalidation, natural stop). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 1 alerts in view, the latest as markers.
  • Market structure and patterns
  • unit: Unitless