TC2000.com• Download software • Tutorial videos • Subscription & data-feed pricing • Class schedule

TC2000Brokerage.com• New account application • Trading resources • Margin rates • Stock & option commissions

Worden Discussion Forum » Customer Training & Support » Ask a Trainer - StockFinder 5.0 » Detrended Price Oscillator

Thanks for getting back to me. Most sources that I have seen are in agreement with the definition you supplied, printed in a simplified manner here.

1. Decide on the time frame that you wish to analyze. Set n as half

of

that cycle period.

2. Calculate a simple moving average for n periods.

3. Calculate (n / 2 + 1)

4. Subtract the moving average, from (n / 2 + 1) days ago, from the

closing price:

DPO = Close - Simple moving average [from (n / 2 + 1) days ago]

Worden Support wrote: It's just the current Price minus the Simple Moving Average of Price using the Period of the DPO for the Moving Average Period offset (Period / 2) + 1 Bars to the left (meaning the Moving Average uses future data in its calculations which is why it ends before the right-edge of the Chart).

The explanation in parenthesis is incorrect. If we are using the current price minus the moving average of X bars ago, there is no future data involved and there is no reason for it to end X number of bars before the right edge.

However, even using the definition as given, Stockfinder does not come up with the answer shown in your formula.

Let's look at a specific example. Assume we want a 10 day DPO on COMPQX.

This according to the formula shown above would be:

Price at the close on 10/2/09 minus the 5 day simple moving average of price offset 6 days to the left.

The values are 2048.11 - 2131.246 or negative 83.136. Stock finder shows the last DPO as of 6 days ago of negative 2.096924.

This is a flaw in the information that is offered in your program.

Instead of referring me to your trainers, why not have your programmers fix the problems. We, who use the program, depend on the program for correct information. The messrs Worden pride themselves on the quality of their programs.

I am not interested only in a workaround for myself, but in having the problem corrected.

What is the next step in addressing this so that the problem is corrected in Stockfinder, not just on my desk.

Regards,

Dan

-----Original Message-----

From: Worden Support [mailto:Support2@Worden.com]

Sent: Thursday, October 01, 2009 1:44 PM

To: delta1@cfl.rr.com

Cc: Worden Support

Subject: Worden Support

Mr. Chiswick,

We inquired about our DPO calculation with our Trainers. They have advised that they can tell you how DPO is calculated in StockFinder. It's just the current Price minus the Simple Moving Average of Price using the Period of the DPO for the Moving Average Period offset (Period / 2) + 1 Bars to the left (meaning the Moving Average uses future data in its calculations which is why it ends before the right-edge of the Chart). Odd Periods are rounded down for purposes of determining the offset.

They're not yet sure how StockFinder is performing that calculation.

They

are still awaiting that information.

It is sad that support does not know that the information is available: You can add the indicator to your chart and edit the realcode. I don't have the time to figure out the problem but here is the code as of 10/3/09:

'# Period = UserInput.Integer = 14 Static AvgC As Single Static Offset(1) As Integer Static Start(2) As Integer If isFirstBar Then AvgC = 0 Offset(0) = (-(Period / 2 + 1)) Start(0) = System.Math.Max(Offset(0), 0) Offset(1) = Offset(0) + Period Start(1) = System.Math.Max(Offset(1), Period) Start(2) = Start(0) + Start(1) - 1 End If If CurrentIndex >= Start(0) Then AvgC += Price.Last(Offset(0)) / Period If CurrentIndex >= Start(1) Then AvgC -= Price.Last(Offset(1)) / Period If CurrentIndex >= Start(2) Then Plot = Price.Last - AvgC Else Plot = Single.NaN End If

Hi Bruce,

Thank you for your thoughtful reply, however there are some things that appear to have changed . You made reference to Technical Analysis from A to Z by Steven Achelis.

Here is what is written in the online version of Technical Analysis from A to Z published by Equis in 2003.

Calculation

To calculate the Detrended Price Oscillator, first create an n-period simple moving average (where "n" is the number of periods in the moving average).

Now, subtract the moving average "(n / 2) + 1" days ago, from the closing price. The result is the DPO.

DPO = Close – (Moving Average”((n/2) + 1)” days ago

Please note that he refers to days ago, not the future.

One of the messages you referred me to mentioned Wikipedia. Here is the article from Wikipedia.

The detrended price oscillator (DPO) is an indicator in technical analysis that attempts to eliminate the long-term trends in prices. Leaving short-term trends, the indicator allows immediate overbought and oversold levels to be found more effectively.

The DPO is calculated by subtracting the simple moving average over an N day period and shifted N/2+1 days back from the price.

To calculate the Detrended Price Oscillator:

Decide on the time frame that you wish to analyze. Set n as half of that cycle period.

Calculate a simple moving average for n periods.

Calculate (n / 2 + 1)

Subtract the moving average, from (n / 2 + 1) days ago, from the closing price:

Rather than go on listing sources that refer to using the MA of n days ago, suffice it to say that the way Stockfinder uses the DPO does not allow its value to be referenced as of the day you wish to trade. Nor does it lend itself to easy backtesting.

FreeStockCharts, another Worden program uses the detrended price oscillator differently from StockFinder and allows for current information to be displayed.

I realize that StockFinder is an enormously flexible program that allows for the creation of indicators to perform in any way desired. What I am asking for is a default set up for DPO that allows the indicator to be used in back testing and in current selection of stocks. Using the present arrangement if I set the DPO to 50 periods and used daily bars, the most recent information would be 26 trading days ago, more than one month. Of what benefit can that be?

If it is not within your purview to make this change to the program, please let me know who to contact. Thank you again for your help.

Attached is a modified version of DPO which uses what has become a widely accepted interpretation of the indicator. We don't know for sure which is correct so we'll offer both in StockFinder. You can open the attachment directly into a running copy of StockFinder and save it for future use until we get it added to the indicator library.

Attachments:Detrended Price Oscillator Modified.sfInd - 6 KB, downloaded 956 time(s).

Having read through this thread, I still have the outstanding question of what formula is used for the DPO as found in v 12.3? Specifically, for the default DPO21?

I ask for the formula and DPO21 example simply because it is not legal to use DPO21 in a pcf, as for example TSV21 can be used without error.

Thank you.

Redeyez

An Indicator Formula for a 21-Period DPO in TC2000 version 12.3 would be:

C - AVGC21.12

This formula is based on the following:

C - AVGCP.(P/2+1)

PCF Formula Descriptions

Many thanks, Bruce. :)

You're welcome.