pqf.indicator.momentum

Functions

macd(data[, slow_period, fast_period, ...])

Calculate the Moving Average Convergence Divergence (MACD) indicator.

rsi(data, period)

Calculate the Relative Strength Index (RSI) for the given data series over a specified period.

pqf.indicator.momentum.macd(data: Series | Expr, slow_period: int = 26, fast_period: int = 12, signal_period: int = 9) Series | Expr[source]

Calculate the Moving Average Convergence Divergence (MACD) indicator.

Parameters:
  • data (pl.Series | pl.Expr) – Time series data for calculation.

  • slow_period (int, optional) – Number of periods for the slow EMA. Defaults to 26.

  • fast_period (int, optional) – Number of periods for the fast EMA. Defaults to 12.

  • signal_period (int, optional) – Number of periods for the signal line. Defaults to 9.

Returns:

The MACD histogram values.

Return type:

pl.Series | pl.Expr

pqf.indicator.momentum.rsi(data: Series | Expr, period: int) Series | Expr[source]

Calculate the Relative Strength Index (RSI) for the given data series over a specified period.

Parameters:
  • data (pl.Series | pl.Expr) – A Polars Series or Expression containing the data for which RSI needs to be calculated.

  • period (int) – An integer specifying the period for RSI calculation.

Returns:

A Polars Series or Expression representing the RSI values calculated based on the input data and period.

Return type:

pl.Series | pl.Expr