Momentum

Momentum Indicators — Oscillators measuring speed and change of price movements.

Functions

RSI — Relative Strength Index MOM — Momentum ROC — Rate of Change: ((price/prevPrice)-1)*100 ROCP — Rate of Change Percentage: (price-prevPrice)/prevPrice ROCR — Rate of Change Ratio: price/prevPrice ROCR100 — Rate of Change Ratio 100 scale: (price/prevPrice)*100 WILLR — Williams’ %R AROON — Aroon (returns aroon_down, aroon_up) AROONOSC — Aroon Oscillator CCI — Commodity Channel Index MFI — Money Flow Index BOP — Balance Of Power STOCHF — Stochastic Fast STOCH — Stochastic STOCHRSI — Stochastic Relative Strength Index APO — Absolute Price Oscillator PPO — Percentage Price Oscillator CMO — Chande Momentum Oscillator PLUS_DM — Plus Directional Movement MINUS_DM — Minus Directional Movement PLUS_DI — Plus Directional Indicator MINUS_DI — Minus Directional Indicator DX — Directional Movement Index ADX — Average Directional Movement Index ADXR — Average Directional Movement Index Rating TRIX — 1-day Rate-Of-Change of Triple Smooth EMA ULTOSC — Ultimate Oscillator TRANGE — True Range (also in volatility)

ferro_ta.momentum.ADX(high, low, close, timeperiod=14)[source]

Average Directional Movement Index.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of ADX values (0–100).

Return type:

numpy.ndarray

ferro_ta.momentum.ADXR(high, low, close, timeperiod=14)[source]

Average Directional Movement Index Rating.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of ADXR values (0–100).

Return type:

numpy.ndarray

ferro_ta.momentum.APO(close, fastperiod=12, slowperiod=26)[source]

Absolute Price Oscillator.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • fastperiod (int, optional) – Fast EMA period (default 12).

  • slowperiod (int, optional) – Slow EMA period (default 26).

Returns:

Array of APO values; leading slowperiod - 1 entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.AROON(high, low, timeperiod=14)[source]

Aroon.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

(aroondown, aroonup) — two arrays of equal length. Leading timeperiod entries are NaN.

Return type:

tuple[numpy.ndarray, numpy.ndarray]

ferro_ta.momentum.AROONOSC(high, low, timeperiod=14)[source]

Aroon Oscillator.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of AROONOSC values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.BOP(open, high, low, close)[source]

Balance Of Power.

Parameters:
  • open (array-like) – Sequence of open prices.

  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

Returns:

Array of BOP values (-1 to 1).

Return type:

numpy.ndarray

ferro_ta.momentum.CCI(high, low, close, timeperiod=14)[source]

Commodity Channel Index.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of CCI values; leading timeperiod - 1 entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.CMO(close, timeperiod=14)[source]

Chande Momentum Oscillator.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of CMO values (-100 to 100); leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.DX(high, low, close, timeperiod=14)[source]

Directional Movement Index.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of DX values (0–100).

Return type:

numpy.ndarray

ferro_ta.momentum.MFI(high, low, close, volume, timeperiod=14)[source]

Money Flow Index.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • volume (array-like) – Sequence of volume values.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of MFI values (0–100); leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.MINUS_DI(high, low, close, timeperiod=14)[source]

Minus Directional Indicator.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of -DI values.

Return type:

numpy.ndarray

ferro_ta.momentum.MINUS_DM(high, low, timeperiod=14)[source]

Minus Directional Movement.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of -DM values.

Return type:

numpy.ndarray

ferro_ta.momentum.MOM(close, timeperiod=10)[source]

Momentum.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 10).

Returns:

Array of MOM values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.PLUS_DI(high, low, close, timeperiod=14)[source]

Plus Directional Indicator.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of +DI values.

Return type:

numpy.ndarray

ferro_ta.momentum.PLUS_DM(high, low, timeperiod=14)[source]

Plus Directional Movement.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • timeperiod (int, optional) – Smoothing period (default 14).

Returns:

Array of +DM values.

Return type:

numpy.ndarray

ferro_ta.momentum.PPO(close, fastperiod=12, slowperiod=26, signalperiod=9)[source]

Percentage Price Oscillator.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • fastperiod (int, optional) – Fast EMA period (default 12).

  • slowperiod (int, optional) – Slow EMA period (default 26).

  • signalperiod (int, optional) – Signal EMA period (default 9).

Returns:

(ppo, signal, histogram) — three arrays of equal length.

Return type:

tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

ferro_ta.momentum.ROC(close, timeperiod=10)[source]

Rate of Change: ((price/prevPrice)-1)*100.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 10).

Returns:

Array of ROC values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.ROCP(close, timeperiod=10)[source]

Rate of Change Percentage: (price-prevPrice)/prevPrice.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 10).

Returns:

Array of ROCP values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.ROCR(close, timeperiod=10)[source]

Rate of Change Ratio: price/prevPrice.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 10).

Returns:

Array of ROCR values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.ROCR100(close, timeperiod=10)[source]

Rate of Change Ratio 100 scale: (price/prevPrice)*100.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 10).

Returns:

Array of ROCR100 values; leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.RSI(close, timeperiod=14)[source]

Relative Strength Index.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of RSI values (0–100); leading timeperiod entries are NaN.

Return type:

numpy.ndarray

ferro_ta.momentum.STOCH(high, low, close, fastk_period=5, slowk_period=3, slowd_period=3)[source]

Stochastic.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • fastk_period (int, optional) – Fast %K period (default 5).

  • slowk_period (int, optional) – Slow %K smoothing period (default 3).

  • slowd_period (int, optional) – Slow %D smoothing period (default 3).

Returns:

(slowk, slowd) — two arrays of equal length.

Return type:

tuple[numpy.ndarray, numpy.ndarray]

ferro_ta.momentum.STOCHF(high, low, close, fastk_period=5, fastd_period=3)[source]

Stochastic Fast.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • fastk_period (int, optional) – %K period (default 5).

  • fastd_period (int, optional) – %D smoothing period (default 3).

Returns:

(fastk, fastd) — two arrays of equal length.

Return type:

tuple[numpy.ndarray, numpy.ndarray]

ferro_ta.momentum.STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3)[source]

Stochastic Relative Strength Index.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – RSI period (default 14).

  • fastk_period (int, optional) – Stochastic %K period (default 5).

  • fastd_period (int, optional) – Stochastic %D smoothing period (default 3).

Returns:

(fastk, fastd) — two arrays of equal length.

Return type:

tuple[numpy.ndarray, numpy.ndarray]

ferro_ta.momentum.TRANGE(high, low, close)[source]

True Range.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

Returns:

Array of True Range values.

Return type:

numpy.ndarray

ferro_ta.momentum.TRIX(close, timeperiod=30)[source]

1-day Rate-Of-Change of a Triple Smooth EMA.

Parameters:
  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – EMA period (default 30).

Returns:

Array of TRIX values.

Return type:

numpy.ndarray

ferro_ta.momentum.ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28)[source]

Ultimate Oscillator.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod1 (int, optional) – First period (default 7).

  • timeperiod2 (int, optional) – Second period (default 14).

  • timeperiod3 (int, optional) – Third period (default 28).

Returns:

Array of ULTOSC values (0–100).

Return type:

numpy.ndarray

ferro_ta.momentum.WILLR(high, low, close, timeperiod=14)[source]

Williams’ %R.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – Number of periods (default 14).

Returns:

Array of WILLR values (-100 to 0); leading timeperiod - 1 entries are NaN.

Return type:

numpy.ndarray