pqf.indicator.moving_average

Functions

exponential_moving_average(prices, window_size)

Calculate the exponential moving average of prices.

simple_moving_average(prices, window_size)

Calculate the simple moving average of prices over a specified window size.

pqf.indicator.moving_average.exponential_moving_average(prices: Series | Expr, window_size: int) Series | Expr[source]

Calculate the exponential moving average of prices.

Parameters:
  • prices (pl.Series | pl.Expr) – Series or Expression containing the prices.

  • window_size (int) – Number of periods to consider in the moving average calculation.

Returns:

Series or Expression with the exponential moving average values.

Return type:

pl.Series | pl.Expr

pqf.indicator.moving_average.simple_moving_average(prices: Expr | Series, window_size: int) Expr | Series[source]

Calculate the simple moving average of prices over a specified window size.

Parameters:
  • prices (pl.Expr | pl.Series) – The input prices data as a Polars expression or series.

  • window_size (int) – The size of the window for calculating the moving average.

Returns:

The simple moving average values.

Return type:

pl.Expr | pl.Series