Calculate the Percentage Price Oscillator (PPO) for a given price series.

The Percentage Price Oscillator (PPO) is a momentum oscillator that measures the difference between two moving averages as a percentage of the longer moving average.

The formula is as follows:

\[\text{PPO} = ((\text{Long-term EMA} - \text{Short-term EMA}) / \text{Short-term EMA}) \cdot 100\]

Also known as: PPO, price oscillator.

Percentage Price Oscillator in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_percentage_price_oscillator as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT"])

toolkit.technicals.get_percentage_price_oscillator()

Which returns:

Date AAPL MSFT Benchmark
2026-06-18 0.1732 -4.0561 0.6878
2026-06-22 0.14 -4.8668 0.6275
2026-06-23 -0.0508 -5.0611 0.3105
2026-06-24 -0.2579 -5.5078 0.0753
2026-06-25 -1.5005 -6.3251 -0.0644
2026-06-26 -1.8165 -5.8609 -0.2913
2026-06-29 -2.1348 -5.645 -0.15
2026-06-30 -1.848 -5.1917 0.0925
2026-07-01 -1.304 -4.2572 0.2353
2026-07-02 -0.022 -3.2398 0.3068

Parameters

The function accepts the following parameters:

  • period (str, optional): The time period to consider for historical data. Can be “daily”, “weekly”, “quarterly”, or “yearly”. Defaults to “daily”.
  • close_column (str, optional): The column in the historical data that represents the closing prices. Defaults to “Adj Close”.
  • short_window (int, optional): The number of periods for the short-term moving average. Defaults to 7.
  • long_window (int, optional): The number of periods for the long-term moving average. Defaults to 28.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • growth (bool, optional): Whether to calculate the growth of the indicator values. Defaults to False.
  • lag (int | list[int], optional): The lag to use for the growth calculation.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. Defaults to 1.
Share