Skip to content

Absolute Price Oscillator

APO measures the absolute difference between two Exponential Moving Averages (EMAs).

Method

tm.ta.apo(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
aponp.ndarray

Example usage

strategy.py
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)