frama
Fractal adaptive moving average of the median price: the smoothing constant follows the fractal dimension o…
frama
examples/site_showcase.rs// Fractal adaptive moving average of the median price: the smoothing constant follows the fractal dimension of the last `period` bars (extra `dimension`, 1 to 2 on usual data). The average equals the median price up to bar period and a window without range keeps the previous dimension. Odd periods are rejected; published from bar period + 1.
// Defaults of "frama" (see the indicator reference)
let params = HashMap::from([
("period".to_string(), 16.0),
]);
let mut indicator = build_checked("frama", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}