Percentage Price Oscillator
PPO is similar to MACD but expressed as a percentage.
Method
tm.ta.ppo(source, fastperiod, slowperiod, matype)
Inputs
Parameter | Argument type | Description | Default Value |
---|---|---|---|
source | pd.Series | Input data series | - |
fastperiod | int | Fast period for the indicator | 12 |
slowperiod | int | Slow period for the indicator | 26 |
matype | int | Type of Moving Average | 0 |
Outputs
Output | Type |
---|---|
ppo | np.ndarray |
Example usage
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)