Pandas DataFrame or GroupBy object containing financial data.
required
date_column
str
Name of the column containing date information.
required
close_column
str
Name of the column containing closing price data.
required
fast_period
int
Number of periods for the fast EMA in PPO calculation.
12
slow_period
int
Number of periods for the slow EMA in PPO calculation.
26
reduce_memory
bool
Whether to reduce memory usage of the data before performing the calculation.
False
engine
str
Computation engine to use (βpandasβ or βpolarsβ).
'pandas'
Returns
Type
Description
pd.DataFrame
DataFrame with PPO values added.
Notes
The Percentage Price Oscillator (PPO) is a momentum oscillator that measures the difference between two moving averages as a percentage of the larger moving average. The PPO is best used to confirm the direction of the price trend and gauge its momentum.
The PPO is calculated by subtracting a long-term EMA from a short-term EMA, then dividing the result by the long-term EMA, and finally multiplying by 100.
Advantages Over MACD: The PPOβs percentage-based calculation allows for easier comparisons between different securities, regardless of their price levels. This is a distinct advantage over the MACD, which provides absolute values and can be less meaningful when comparing stocks with significantly different prices.
Examples
import pandas as pdimport pytimetk as tkdf = tk.load_dataset("stocks_daily", parse_dates = ['date'])df