smoothed_supertrend
Smoothed Supertrend: baseline = EMA(ema_len) of WMA(wma_len) of the supertrend midline
smoothed_supertrend
examples/site_showcase.rs// Smoothed Supertrend: baseline = EMA(ema_len) of WMA(wma_len) of the supertrend midline (factor x ATR(atr_len)); trend from the baseline slope over slope_lookback bars with an ATR threshold and hysteresis; value = baseline; extra: trend, st_lower, st_upper, adx, strength_rank (percentrank of |slope|/ATR), distance_rank, overextension (+1/-1); alerts bull/bear_flip (trend turn with ADX above adx_threshold), bull/bear_rejection and bull/bear_rejection_strong (baseline touch and close back on the trend side; strong = strength rank above strength_threshold)
// Defaults of "smoothed_supertrend" (see the indicator reference)
let params = HashMap::from([
("adx_threshold".to_string(), 25.0),
("atr_len".to_string(), 90.0),
("ema_len".to_string(), 14.0),
("factor".to_string(), 12.0),
("slope_lookback".to_string(), 3.0),
("slope_threshold".to_string(), 0.05),
("touches".to_string(), 2.0),
("wma_len".to_string(), 40.0),
]);
let mut indicator = build_checked("smoothed_supertrend", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}