kestrel-chartkitv0.33.0

← All examples

adx

Average Directional Index

adx

examples/site_showcase.rs
// Average Directional Index
// Defaults of "adx" (see the indicator reference)
let params = HashMap::from([
    ("adx_smooth".to_string(), 14.0),
    ("di_len".to_string(), 14.0),
    ("level_weak".to_string(), 20.0),
]);
let mut indicator = build_checked("adx", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Average Directional Index. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 9 alerts in view, the latest as markers.Average Directional Index. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 9 alerts in view, the latest as markers.
  • Volatility and trend strength
  • unit: Ratio