Function traquer::volume::ad

source ·
pub fn ad<'a>(
    high: &'a [f64],
    low: &'a [f64],
    close: &'a [f64],
    volume: &'a [f64],
    alt: Option<bool>,
) -> Box<dyn Iterator<Item = f64> + 'a>
Expand description

Accumulation/Distribution (A/D) indicator

Developed by Marc Chaikin. A momentum indicator that measures the flow of money into and out of a security.

Calculated by multiplying the money flow multiplier (which is based on the security’s price and volume) by the money flow volume (which is the volume at the current price level). This function supports alternate logic to consider prior close like yahoo

§Usage

An increasing value suggests an uptrend.

§Sources

[1]

§Examples

use traquer::volume;

volume::ad(
    &vec![1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    &vec![1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    &vec![1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    &vec![1.0,2.0,3.0,4.0,5.0,6.0,4.0,5.0],
    None).collect::<Vec<f64>>();