question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detrended Price Oscillator (DPO) has missing Values depending on the offset / Lookback

See original GitHub issue

Hi,

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:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DaveSkendercommented, Dec 7, 2021

I didn’t knew there was another “way” of calculating the DPO.

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.

0reactions
github-actions[bot]commented, Mar 8, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found