Open CMobley7 opened 2 years ago
@CMobley7,
Hmmm... Yeah you may be right. I thought I corrected this in #60. 🤦🏼♂️ I will take a look at it again. Thanks for the extra eyes.
KJ
@twopirllc ,
I read through https://github.com/twopirllc/pandas-ta/issues/60. The new centered version, https://github.com/twopirllc/pandas-ta/blob/development/pandas_ta/trend/dpo.py#L54, appears to be correct, but the non-centered version, https://github.com/twopirllc/pandas-ta/blob/development/pandas_ta/trend/dpo.py#L52, shifts the ma
instead of the close
. The previous non-centered version, https://github.com/twopirllc/pandas-ta/blob/279423a50675191729f665a801f7ee18323a4efa/pandas_ta/trend/dpo.py#L14, appears to shift correctly, but calculates the ma using pandas's rolling and mean operations instead of the pandas-ta
ma
function, which I believe better suited for this case.
According to https://www.fidelity.com/learning-center/trading-investing/technical-analysis/technical-indicator-guide/dpo and https://www.investopedia.com/terms/d/detrended-price-oscillator-dpo.asp, the
Detrended Price Oscillator: dpo
should beclose.shift(t) - ma
; however, it appears to be reversed in https://github.com/twopirllc/pandas-ta/blob/development/pandas_ta/trend/dpo.py#L52. If I'm right, and you're up for it, I can submit a PR for this and the documentation fix at the same time. Thanks again for such a great library!