Skip to content

Percentage Price Oscillator

PPO is similar to MACD but expressed as a percentage.

Method

tm.ta.ppo(source, fastperiod, slowperiod, matype)

Inputs

ParameterArgument typeDescriptionDefault Value
sourcepd.SeriesInput data series-
fastperiodintFast period for the indicator12
slowperiodintSlow period for the indicator26
matypeintType of Moving Average0

Outputs

OutputType
pponp.ndarray

Example usage

strategy.py
import tradomate as tm
@tm.strategy()
def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Percentage Price Oscillator
ppo = tm.ta.ppo(data.close, fastperiod=12, slowperiod=26, matype=0)
# Get the last value and print
last_value = ppo.iloc[-1]
tm.log(f"Last value of Percentage Price Oscillator is {last_value}")
# Plot the values of ppo
tm.plot(ppo, title="Percentage Price Oscillator", overlay=False)