price_average_relation
Price-Average Relation: price against one moving average
price_average_relation
examples/site_showcase.rs// Price-Average Relation: price against one moving average (ma_kind 0 EMA, 1 SMA, 2 RMA, 3 ALMA); value = relationship oscillator -100..100 (signed trend quality minus an extension/exhaustion penalty), secondary = its signal line; extra: trend, respect, extension, compression, acceleration, exhaustion (0..100), ma, distance_atr, respect_samples, respect_hit_rate, direction; alerts bull/bear_pullback, _momentum_release, _exhaustion (prefix = expected move), _relationship_break, _divergence, _turn, do_not_chase_up/down
// Defaults of "price_average_relation" (see the indicator reference)
let params = HashMap::from([
("atr_len".to_string(), 14.0),
("cooldown".to_string(), 8.0),
("ma_kind".to_string(), 0.0),
("ma_len".to_string(), 50.0),
("turn_level".to_string(), 55.0),
("turn_lookback".to_string(), 30.0),
]);
let mut indicator = build_checked("price_average_relation", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}