kestrel-chartkitv0.43.0

← All examples

swing_structure

Statistical swing structure: the median correction over the median impulse leg

swing_structure

examples/site_showcase.rs
// Statistical swing structure: the median correction over the median impulse leg (both in ATRs) as value, with the retracement, remaining potential, required stop, reward-to-risk and impulse velocity in ATRs, the newest three corrections and the trend quality (-1 weakening .. 1 strengthening) as extras
// Defaults of "swing_structure" (see the indicator reference)
let params = HashMap::from([
    ("atr_len".to_string(), 14.0),
    ("left".to_string(), 5.0),
    ("max_swings".to_string(), 50.0),
    ("right".to_string(), 5.0),
]);
let mut indicator = build_checked("swing_structure", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}

Not yet verified: no independent second implementation yet.

Statistical swing structure: the median correction over the median impulse leg (both in ATRs) as value, with the retracement, remaining potential, required stop, reward-to-risk and impulse velocity in ATRs, the newest three corrections and the trend quality (-1 weakening .. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.Statistical swing structure: the median correction over the median impulse leg (both in ATRs) as value, with the retracement, remaining potential, required stop, reward-to-risk and impulse velocity in ATRs, the newest three corrections and the trend quality (-1 weakening .. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 0 alerts in view, the latest as markers.
  • Market structure and patterns
  • unit: Unitless