Absolute Price Oscillator
APO measures the absolute difference between two Exponential Moving Averages (EMAs).
Method
tm.ta.apo(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 |
---|---|
apo | np.ndarray |
Example usage
import tradomate as tm
@tm.strategy()def my_strategy(config: tm.TradomateConfig, data: tm.TradomateData):
# Trying out Absolute Price Oscillator apo = tm.ta.apo(data.close, fastperiod=12, slowperiod=26, matype=0)
# Get the last value and print last_value = apo.iloc[-1] tm.log(f"Last value of Absolute Price Oscillator is {last_value}")
# Plot the values of apo tm.plot(apo, title="Absolute Price Oscillator", overlay=False)