kestrel-chartkitv0.41.0

← All examples

trendlines

Trendlines through confirmed zigzag_advanced nodes: a support line through the lows and a resistance line t…

trendlines

examples/site_showcase.rs
// Trendlines through confirmed zigzag_advanced nodes: a support line through the lows and a resistance line through the highs (oldest anchor no node in between pierces by more than tolerance_atr ATR, newest node), each with its channel parallel, node and bar touches and its break on a close beyond it; value = lines in the output; extra: atr, tolerance, support_*/resistance_* (value, start_price, start_bars_back, end_price, end_bars_back, nodes, node_touches, touches, touch, formed, break, channel_value, channel_width); alerts bear_support_line_break, bull_resistance_line_break
// Defaults of "trendlines" (see the indicator reference)
let params = HashMap::from([
    ("atr_len".to_string(), 14.0),
    ("backstep".to_string(), 2.0),
    ("depth".to_string(), 3.0),
    ("deviation_mode".to_string(), 0.0),
    ("deviation_pct".to_string(), 1.0),
    ("tolerance_atr".to_string(), 0.25),
]);
let mut indicator = build_checked("trendlines", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Trendlines through confirmed zigzag_advanced nodes: a support line through the lows and a resistance line through the highs (oldest anchor no node in between pierces by more than tolerance_atr ATR, newest node), each with its channel parallel, node and bar touches and its break on a close beyond it; value = lines in the output; extra: atr, tolerance, support_*/resistance_* (value, start_price, sta. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 6 alerts in view, the latest as markers.Trendlines through confirmed zigzag_advanced nodes: a support line through the lows and a resistance line through the highs (oldest anchor no node in between pierces by more than tolerance_atr ATR, newest node), each with its channel parallel, node and bar touches and its break on a close beyond it; value = lines in the output; extra: atr, tolerance, support_*/resistance_* (value, start_price, sta. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 6 alerts in view, the latest as markers.
  • Market structure and patterns
  • unit: Unitless