CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-ta-lib

Python wrapper for TA-LIB providing 175+ technical analysis indicators for financial market data

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

momentum-indicators.mddocs/

Momentum Indicators

Oscillators and momentum-based indicators that measure the rate of price change and help identify overbought/oversold conditions, divergences, and potential reversal points. These indicators typically oscillate within defined ranges or show the momentum of price movements.

Capabilities

Relative Strength Index

Momentum oscillator that measures the speed and magnitude of price changes, ranging from 0 to 100.

def RSI(real, timeperiod=14):
    """
    Relative Strength Index
    
    Parameters:
    - real: array-like, input price data (typically close prices)
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: RSI values (0-100 range)
    """

MACD

Moving Average Convergence Divergence - trend-following momentum indicator showing relationship between two moving averages.

def MACD(real, fastperiod=12, slowperiod=26, signalperiod=9):
    """
    Moving Average Convergence/Divergence
    
    Parameters:
    - real: array-like, input price data
    - fastperiod: int, fast EMA period (default: 12)
    - slowperiod: int, slow EMA period (default: 26)
    - signalperiod: int, signal line EMA period (default: 9)
    
    Returns:
    tuple: (macd_line, signal_line, histogram)
    """

MACD Extended

MACD with customizable moving average types for fast, slow, and signal lines.

def MACDEXT(real, fastperiod=12, fastmatype=MA_Type.SMA, slowperiod=26, 
            slowmatype=MA_Type.SMA, signalperiod=9, signalmatype=MA_Type.SMA):
    """
    MACD with controllable MA type
    
    Parameters:
    - real: array-like, input price data
    - fastperiod: int, fast MA period (default: 12)
    - fastmatype: MA_Type, fast MA type (default: SMA)
    - slowperiod: int, slow MA period (default: 26)
    - slowmatype: MA_Type, slow MA type (default: SMA)
    - signalperiod: int, signal MA period (default: 9)
    - signalmatype: MA_Type, signal MA type (default: SMA)
    
    Returns:
    tuple: (macd_line, signal_line, histogram)
    """

MACD Fixed

MACD with fixed 12/26 periods, only allowing customization of signal period.

def MACDFIX(real, signalperiod=9):
    """
    Moving Average Convergence/Divergence Fix 12/26
    
    Parameters:
    - real: array-like, input price data
    - signalperiod: int, signal line period (default: 9)
    
    Returns:
    tuple: (macd_line, signal_line, histogram)
    """

Stochastic

Momentum oscillator comparing closing price to high-low range over a given time period.

def STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=MA_Type.SMA, 
          slowd_period=3, slowd_matype=MA_Type.SMA):
    """
    Stochastic
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - fastk_period: int, fast %K period (default: 5)
    - slowk_period: int, slow %K period (default: 3)
    - slowk_matype: MA_Type, slow %K MA type (default: SMA)
    - slowd_period: int, slow %D period (default: 3)
    - slowd_matype: MA_Type, slow %D MA type (default: SMA)
    
    Returns:
    tuple: (slowk, slowd) - %K and %D values
    """

Fast Stochastic

Fast version of stochastic oscillator without additional smoothing.

def STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=MA_Type.SMA):
    """
    Stochastic Fast
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - fastk_period: int, fast %K period (default: 5)
    - fastd_period: int, fast %D period (default: 3)
    - fastd_matype: MA_Type, fast %D MA type (default: SMA)
    
    Returns:
    tuple: (fastk, fastd) - Fast %K and %D values
    """

Stochastic RSI

Stochastic oscillator applied to RSI values instead of price data.

def STOCHRSI(real, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=MA_Type.SMA):
    """
    Stochastic Relative Strength Index
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, RSI period (default: 14)
    - fastk_period: int, fast %K period (default: 5)
    - fastd_period: int, fast %D period (default: 3)
    - fastd_matype: MA_Type, fast %D MA type (default: SMA)
    
    Returns:
    tuple: (fastk, fastd) - Stochastic RSI %K and %D values
    """

Average Directional Movement Index

Measures trend strength regardless of direction, ranging from 0 to 100.

def ADX(high, low, close, timeperiod=14):
    """
    Average Directional Movement Index
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: ADX values (0-100 range)
    """

ADX Rating

Smoothed version of ADX providing additional filtering.

def ADXR(high, low, close, timeperiod=14):
    """
    Average Directional Movement Index Rating
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: ADXR values
    """

Commodity Channel Index

Momentum-based oscillator used to identify cyclical trends and overbought/oversold conditions.

def CCI(high, low, close, timeperiod=14):
    """
    Commodity Channel Index
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: CCI values
    """

Aroon

Identifies trend changes and measures trend strength by calculating time since highest high and lowest low.

def AROON(high, low, timeperiod=14):
    """
    Aroon
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    tuple: (aroondown, aroonup) - Aroon Down and Up values
    """

Aroon Oscillator

Difference between Aroon Up and Aroon Down, ranging from -100 to +100.

def AROONOSC(high, low, timeperiod=14):
    """
    Aroon Oscillator
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: Aroon Oscillator values (-100 to +100)
    """

Williams %R

Momentum indicator similar to stochastic, measuring overbought/oversold levels.

def WILLR(high, low, close, timeperiod=14):
    """
    Williams' %R
    
    Parameters:
    - high: array-like, high prices
    - low: array-like, low prices
    - close: array-like, close prices
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: Williams %R values (-100 to 0 range)
    """

Momentum

Rate of change indicator showing the difference between current and historical prices.

def MOM(real, timeperiod=10):
    """
    Momentum
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, number of periods (default: 10)
    
    Returns:
    numpy.ndarray: Momentum values
    """

Rate of Change

Percentage change between current and historical prices.

def ROC(real, timeperiod=10):
    """
    Rate of change: ((price/prevPrice)-1)*100
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, number of periods (default: 10)
    
    Returns:
    numpy.ndarray: ROC percentage values
    """

Rate of Change Percentage

Alternative rate of change calculation.

def ROCP(real, timeperiod=10):
    """
    Rate of change Percentage: (price-prevPrice)/prevPrice
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, number of periods (default: 10)
    
    Returns:
    numpy.ndarray: ROCP values
    """

Rate of Change Ratio

Ratio-based rate of change calculation.

def ROCR(real, timeperiod=10):
    """
    Rate of change ratio: (price/prevPrice)
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, number of periods (default: 10)
    
    Returns:
    numpy.ndarray: ROCR values
    """

Rate of Change Ratio 100

Ratio-based ROC scaled to 100.

def ROCR100(real, timeperiod=10):
    """
    Rate of change ratio 100 scale: (price/prevPrice)*100
    
    Parameters:
    - real: array-like, input price data
    - timeperiod: int, number of periods (default: 10)
    
    Returns:
    numpy.ndarray: ROCR100 values
    """

Additional Momentum Indicators

def APO(real, fastperiod=12, slowperiod=26, matype=MA_Type.SMA):
    """Absolute Price Oscillator"""

def BOP(open, high, low, close):
    """Balance Of Power"""

def CMO(real, timeperiod=14):
    """Chande Momentum Oscillator"""

def DX(high, low, close, timeperiod=14):
    """Directional Movement Index"""

def MFI(high, low, close, volume, timeperiod=14):
    """Money Flow Index"""

def MINUS_DI(high, low, close, timeperiod=14):
    """Minus Directional Indicator"""

def MINUS_DM(high, low, timeperiod=14):
    """Minus Directional Movement"""

def PLUS_DI(high, low, close, timeperiod=14):
    """Plus Directional Indicator"""

def PLUS_DM(high, low, timeperiod=14):
    """Plus Directional Movement"""

def PPO(real, fastperiod=12, slowperiod=26, matype=MA_Type.SMA):
    """Percentage Price Oscillator"""

def TRIX(real, timeperiod=30):
    """1-day Rate-Of-Change (ROC) of a Triple Smooth EMA"""

def ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28):
    """Ultimate Oscillator"""

def IMI(open, close, timeperiod=14):
    """
    Intraday Momentum Index
    
    Momentum oscillator that uses intraday price movements to identify
    overbought and oversold conditions, similar to RSI but based on 
    opening and closing price relationships.
    
    Parameters:
    - open: array-like, opening prices
    - close: array-like, closing prices  
    - timeperiod: int, number of periods (default: 14)
    
    Returns:
    numpy.ndarray: IMI values (0-100 range)
    """

Install with Tessl CLI

npx tessl i tessl/pypi-ta-lib

docs

abstract-streaming.md

cycle-indicators.md

index.md

math-operations.md

momentum-indicators.md

overlap-studies.md

pattern-recognition.md

price-transform.md

statistical-functions.md

volatility-indicators.md

volume-indicators.md

tile.json