yiii0012/moontalib/momentum does not have a README file

    AdxResult

    pub struct AdxResult {
    adx : Array[Double]
    plus_di : Array[Double]
    minus_di : Array[Double]
    dx : Array[Double]
    }

    ADX decomposition: the ADX trend-strength line, the +DI and -DI directional indicators, and the raw DX line that ADX smooths. All four arrays have the input length.

    AroonResult

    pub struct AroonResult {
    down : Array[Double]
    up : Array[Double]
    }

    Aroon decomposition: the down and up lines, both of input length.

    Macd

    pub struct Macd {
    macd : Array[Double]
    signal : Array[Double]
    hist : Array[Double]
    }

    MACD decomposition: the MACD line, its signal line and the histogram (MACD minus signal). All three arrays have the input length.

    Stoch

    pub struct Stoch {
    k : Array[Double]
    d : Array[Double]
    }

    Stochastic decomposition: the %K and %D lines, both of input length.

    adx

    Average Directional Index.

    True range and directional movement are accumulated with Wilder's smoothing (s = s - s / period + current, seeded by a simple sum over the first period changes). +DI/-DI are valid from index period, and ADX (a Wilder average of the DX) from index 2 * period - 1. A zero smoothed true range (perfectly flat window) maps the DI lines to 0.

    adx_lookback

    fn adx_lookback(period : Int) -> Int

    Number of leading NaN values produced by adx for the given period: 2 * period - 1 (the DI lines themselves are valid from period).

    apo

    fn apo(data : Array[Double], fast_period : Int, slow_period : Int, ma_type~ :
    MAType
    ) -> Array[Double] raise
    TaError

    Absolute Price Oscillator: fast_MA - slow_MA with a selectable MA flavor.

    aroon

    Aroon up/down.

    For each bar the window spans the period bars before it plus itself (TA-Lib convention, period + 1 data points). up is 100 * (period - bars_since_highest_high) / period and down mirrors it with the lowest low; when several bars share the extreme, the most recent occurrence wins. A window containing NaN yields NaN for that position.

    aroon_lookback

    fn aroon_lookback(period : Int) -> Int

    Number of leading NaN values produced by aroon for the given period: period (the window covers period + 1 bars including the current one).

    aroonosc

    fn aroonosc(candles :
    Candles
    , period : Int) -> Array[Double] raise
    TaError

    Aroon Oscillator: up - down. Ranges from -100 (downtrend) to +100 (uptrend) with the same window rules as aroon.

    aroonosc_lookback

    fn aroonosc_lookback(period : Int) -> Int

    Number of leading NaN values produced by aroonosc for the given period.

    bop

    Balance of Power (Igor Livshin): (close - open) / (high - low). A flat bar (high equals low) reads 0; any NaN component yields NaN.

    cci

    Commodity Channel Index (Donald Lambert): the deviation of the typical price (high + low + close) / 3 from its SMA, normalized by 0.015 * mean absolute deviation. A flat window (mean deviation 0) reads 0.

    cci_lookback

    fn cci_lookback(period : Int) -> Int

    Number of leading NaN values produced by cci for the given period.

    cmo

    fn cmo(data : Array[Double], period : Int) -> Array[Double] raise
    TaError

    Chande Momentum Oscillator: 100 * (sum_up - sum_down) / (sum_up + sum_down) over the last period price changes. A completely flat window reads 0.

    cmo_lookback

    fn cmo_lookback(period : Int) -> Int

    Number of leading NaN values produced by cmo for the given period.

    Directional Movement Index (DX): the raw 100 * |+DI - -DI| / (+DI + -DI) ratio that adx smooths, valid from index period.

    dx_lookback

    fn dx_lookback(period : Int) -> Int

    Number of leading NaN values produced by dx for the given period.

    macd

    fn macd(data : Array[Double], fast_period : Int, slow_period : Int, signal_period : Int) -> Macd raise
    TaError

    Moving Average Convergence/Divergence.

    The MACD line is EMA(fast) - EMA(slow) and becomes valid at index slow_period - 1. The signal line is an EMA of the MACD line seeded with the SMA of the first signal_period MACD values, valid at index slow_period + signal_period - 2. Uses the SMA-seeded EMA of overlap (TA-Lib convention), so a NaN input poisons the chain from that point on.

    macd_lookback

    fn macd_lookback(slow_period : Int, signal_period : Int) -> Int

    Number of leading NaN values: (slow - 1) + (signal - 1).

    mom

    fn mom(data : Array[Double], period : Int) -> Array[Double] raise
    TaError

    Momentum: x[i] - x[i - period]. NaN inputs yield NaN.

    mom_lookback

    fn mom_lookback(period : Int) -> Int

    Number of leading NaN values produced by mom for the given period.

    ppo

    fn ppo(data : Array[Double], fast_period : Int, slow_period : Int, ma_type~ :
    MAType
    ) -> Array[Double] raise
    TaError

    Percentage Price Oscillator: 100 * (fast_MA - slow_MA) / slow_MA. A zero slow MA yields NaN.

    roc

    fn roc(data : Array[Double], period : Int) -> Array[Double] raise
    TaError

    Rate of change in percent: 100 * (x[i] - x[i - period]) / x[i - period]. A zero base value yields NaN.

    roc_lookback

    fn roc_lookback(period : Int) -> Int

    Number of leading NaN values produced by roc for the given period.

    rsi

    fn rsi(data : Array[Double], period : Int) -> Array[Double] raise
    TaError

    Relative Strength Index.

    The seed is the simple average of gains and losses over the first period price changes; later averages use Wilder smoothing avg = (prev * (period - 1) + current) / period. The first value lands at index period. NaN inputs poison the seed and propagate forward.

    rsi_lookback

    fn rsi_lookback(period : Int) -> Int

    Number of leading NaN values produced by rsi for the given period.

    stoch

    fn stoch(candles :
    Candles
    , period : Int, k_slowing~ : Int, d_period~ : Int) -> Stoch raise
    TaError

    Stochastic Oscillator (TA-Lib STOCH): raw %K is smoothed by an SMA over k_slowing bars (slow %K), and %D is an SMA of slow %K over d_period bars.

    stoch_lookback

    fn stoch_lookback(period : Int, k_slowing : Int, d_period : Int) -> Int

    Number of leading NaN values produced by stoch: (period - 1) + (k_slowing - 1) + (d_period - 1).

    stochf

    fn stochf(candles :
    Candles
    , period : Int, d_period~ : Int) -> Stoch raise
    TaError

    Fast stochastic: raw %K plus its SMA over d_period (%D). The %D line is valid at index period + d_period - 2.

    trix

    fn trix(data : Array[Double], period : Int) -> Array[Double] raise
    TaError

    TRIX: the percent rate of change of a triple-EMA, 100 * (e3[i] - e3[i - 1]) / e3[i - 1].

    trix_lookback

    fn trix_lookback(period : Int) -> Int

    Number of leading NaN values produced by trix for the given period: 3 * (period - 1) + 1.

    ultosc

    fn ultosc(candles :
    Candles
    , p1~ : Int, p2~ : Int, p3~ : Int) -> Array[Double] raise
    TaError

    Ultimate Oscillator.

    Buying pressure is close - min(low, prev_close) and true range is max(high, prev_close) - min(low, prev_close). For each of the three periods the ratio sum(BP) / sum(TR) is taken, then blended as 100 * (4 * avg1 + 2 * avg2 + avg3) / 7 with avg1 <= avg2 <= avg3 the short / mid / long ratios. A window whose true-range sum is zero, or that contains NaN, yields NaN. The periods must satisfy p1 <= p2 <= p3.

    ultosc_lookback

    fn ultosc_lookback(p3 : Int) -> Int

    Number of leading NaN values produced by ultosc: the longest period p3 (each output needs p3 buying-pressure / true-range values).

    willr

    Williams %R: -100 * (highest_high - close) / (highest_high - lowest_low) over the window, computed through the identity %R = %K - 100. A flat window therefore reads -100, mirroring the raw %K rule (reads 0).

    willr_lookback

    fn willr_lookback(period : Int) -> Int

    Number of leading NaN values produced by willr for the given period.