kestrel-chartkitv0.41.0

← All examples

supertrend

Supertrend ATR Trailing Stop

supertrend

examples/site_showcase.rs
// Supertrend ATR Trailing Stop
// Defaults of "supertrend" (see the indicator reference)
let params = HashMap::from([
    ("multiplier".to_string(), 3.0),
    ("period".to_string(), 10.0),
]);
let mut indicator = build_checked("supertrend", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
Supertrend ATR Trailing Stop. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.Supertrend ATR Trailing Stop. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 4 alerts in view, the latest as markers.
  • Moving averages, bands and trend lines
  • unit: Price