kestrel-chartkitv0.33.0

← All examples

williams_r

Williams %R

williams_r

examples/site_showcase.rs
// Williams %R (0..100 convention; value is the EMA(avg_len) of the raw line, avg_len = 1 gives the raw line)
// Defaults of "williams_r" (see the indicator reference)
let params = HashMap::from([
    ("avg_len".to_string(), 3.0),
    ("overbought".to_string(), 80.0),
    ("oversold".to_string(), 20.0),
    ("wpr_len".to_string(), 14.0),
]);
let mut indicator = build_checked("williams_r", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Williams %R (0..100 convention; value is the EMA(avg_len) of the raw line, avg_len = 1 gives the raw line). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 34 alerts in view, the latest as markers.Williams %R (0..100 convention; value is the EMA(avg_len) of the raw line, avg_len = 1 gives the raw line). Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 34 alerts in view, the latest as markers.
  • Oscillators
  • unit: Ratio