kestrel_swing_structure
Kestrel statistical swing structure: the median correction over the median impulse leg
kestrel_swing_structure
examples/site_showcase.rs// Kestrel 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. Purpose: trend strength as the sizes of impulse and correction legs in ATRs instead of a binary trend flag; highs and lows are treated alike, so a reflected series reads the same. Use: how deep corrections usually run, how far the current one has come and how much of a typical impulse would remain. Caveat: every pivot is known `right` bars late, and the entry zone and reward-to-risk describe the swing measured so far; they are no orders
// Defaults of "kestrel_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("kestrel_swing_structure", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}