Detrended Price Oscillator (DPO) has missing Values depending on the offset / Lookback
See original GitHub issueHi,
I’m trying to use the DPO for my Backtests and observed some strange behavior. Its missing the latest Values depending on the lookback.
Lets say I have a lookback of 21, then the list is missing the latest 10 values.
its calculated like this:
int offset = lookbackPeriods / 2 + 1;
but then:
if (i >= lookbackPeriods - offset - 1 && i < size - offset)
{
SmaResult s = sma[i + offset];
r.Sma = s.Sma;
r.Dpo = q.Close - s.Sma;
}
It is trying to add the offset to the SMA “i” (SmaResult s = sma[i + offset]😉 instead of subtracting it. At least if I’m not wrong, or missing something.
Thank you 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Detrended Price Oscillator (DPO): Overview, Calculations
A detrended price oscillator is an oscillator that strips out price trends in an effort to estimate the length of price cycles from...
Read more >Technical Analysis Basics: The Detrended Price Oscillator ...
DPO is not typically on the same level with current prices, it's offset to the left (to the past) which helps to remove...
Read more >Detrended Price Oscillator (DPO) - ChartSchool
The Detrended Price Oscillator is not well suited for scans because the indicator is based on an offset moving average. A 20-day DPO...
Read more >The detrended price oscillator is used to remove trend from ...
The Detrended Price Oscillator (DPO) is used to remove trend from price. This is done in order to identify and isolate short-term cycles....
Read more >What Is Detrended Price Oscillator (DPO): Identifying ...
The detrended price oscillator (DPO) is an indicator that identifies the broader, underlying cycles in an asset or crypto's price movements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Me neither! I’ve not seen that before. Community contributions on TV tend to have some creative interpretations or additions, not all make sense and are often not part of the original definition. I tend to stick with the original definitions from the original source but have made a few exceptions. I generally prefer to not add things just because someone else did it, especially if I don’t understand its added value, just to keep things simpler.
This Issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new Issue for related bugs.