kestrel-chartkitv0.49.0

← All examples

true_range_money_flow

True range money flow, a money flow ratio like cmf: the close located in the true range

true_range_money_flow

examples/site_showcase.rs
// True range money flow, a money flow ratio like cmf: the close located in the true range (previous close included, so gaps count), weighted by volume. Volume and weighted volume are Wilder averages, so no bar drops out of a window. Each bar's volume is capped at volume_cap times the Wilder average volume before the bar (after Katsanos, 2004), so a single spike cannot dominate; 0 turns the cap off. Nothing is published while the averaged volume is zero
// Defaults of "true_range_money_flow" (see the indicator reference)
let params = HashMap::from([
    ("period".to_string(), 21.0),
    ("volume_cap".to_string(), 2.5),
]);
let mut indicator = build_checked("true_range_money_flow", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
True range money flow, a money flow ratio like cmf: the close located in the true range (previous close included, so gaps count), weighted by volume. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 10 alerts in view, the latest as markers.True range money flow, a money flow ratio like cmf: the close located in the true range (previous close included, so gaps count), weighted by volume. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 10 alerts in view, the latest as markers.
  • Volume
  • unit: Ratio