dpo#

API documentation for pandas_ta.trend.dpo Python function.

dpo(close, length=None, centered=True, offset=None, **kwargs)[source]#

Detrend Price Oscillator (DPO)

Is an indicator designed to remove trend from price and make it easier to identify cycles.

Sources:

https://www.tradingview.com/scripts/detrendedpriceoscillator/ https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/dpo http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:detrended_price_osci

Calculation:
Default Inputs:

length=20, centered=True

SMA = Simple Moving Average t = int(0.5 * length) + 1

DPO = close.shift(t) - SMA(close, length) if centered:

DPO = DPO.shift(-t)

Args:

close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 1 centered (bool): Shift the dpo back by int(0.5 * length) + 1. Default: True offset (int): How many periods to offset the result. Default: 0

Kwargs:

fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method

Returns:

pd.Series: New feature generated.