Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Detrended Price Oscillator Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rocky
Posted : Saturday, September 29, 2018 3:14:44 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

I have a question about the Detrended Price Oscillator.  I have been studying the DPO 3 in Stock Finder 4.  I also added the DPO 3 to TC2K version 18.  Using the SPY in SF4 the SPY would show a rising price whenever the DPO3 was below zero and a falling price whenever the DPO was above zero.  The opposite is true in TC2K V.18.  In addition, the DPO 3 in SF4 is offset by three days (daily chart) and not offset at all in TC2K.  Since it is a cycle indicator (according to SF4) I would like to add it to my indicators in my trading system.  It shows promise the way it is calculated in SF4 but not so much in TC2K.  Can you explain and give me a formula for the DPO 3 as calculated in SF4 for TC2K?

Thank you in advance for your help.

 

Bruce_L
Posted : Monday, October 1, 2018 12:54:22 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The formula for the SF4 version of DPO3 would be the following.

C2- AVGC3

If you plot this as a Custom PCF Indicator, you will need to add a 1-period simple moving average with the Offset set to -2 to plot this correctly on the chart (set the opacity of the Custom PCF Indicator all the way to the left so it isn't visible).

You might want to review the following for alternate interpretations and why I would tend to think another version of this would actually be better (but which can only accurately offset correctly in TC2000 if the period is odd).

C1 - AVGC3

This would need to have the 1-period simple moving average offset by -1 bars instead of -2 bars.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rocky
Posted : Monday, October 1, 2018 4:37:25 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

Wow Bruce.  After following your link and reading all of the posts, I do not think I have seen so much disagreement on what is right about a single indicator.  The reason that I ask for the SF4 formula is that it seems to identify a change in trend (short or long) which is what I am shooting for as a swing trader.  I will try both formulas to see what will work for me.  

My goal is to find indicators which are cycle based, market strength based, and momentum based. The one I lacked was the cycle based.  There are not many to choose from and the DPO seemed to fit the bill for me.

In SF4 the DPO shows the up trend whenver the indicator is below zero and a down trend when above zero.  This is unusual with indicators that use zero for the crossing point. Most work opposite from this

Bruce_L
Posted : Monday, October 1, 2018 5:06:25 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The two versions of DPO3 presented above both shift the direction of the moving average in what we would both seem to think is the "correct" direction. The formulas are very similar.

The difference is the second formula given calculates the difference between price and the moving average as well as the offset using the center of the data. The first formula does not.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rocky
Posted : Monday, October 1, 2018 5:23:47 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

You go above and beyond the call of duty.  You have been a tremendous blessing to me over the years.  Thank you so much for your help.

rocky
Posted : Wednesday, October 3, 2018 6:53:52 AM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

Bruce,

The default Detrended Price Oscillator offered in TC2000 version 18 works differently than StockFinder 4.  In TC2K the DPO rises as price rises and falls as price falls.  The DPO in SF4 does the opposite.  Can you give me the blocks formula for the TC2K DPO for SF4 so that I can study it and run some back tests on it?

 

Bruce_L
Posted : Wednesday, October 3, 2018 8:37:19 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Did you try the formulas given above? The first formula is the SF4 formula for DPO3 (it just needs to be offset as described using a moving average to get it plotted at the same location).

The generalized version of the SF4 DPO would be:

Cq - AVGCp

Where p is the period of the DPO.
Where q is ((p / 2) + 1) rounded down to the nearest integer.

A better formula is probably the following for odd periods.

Cq - AVGCp

Where p is the period of the DPO.
Where q is ((p - 1) / 2) with no rounding required.

You could choose to round down or round up (up to you really) for even periods, but the better option in the case of even periods would be the following.

AVGC2.q - AVGCp

Where p is the period of the DPO.
Where q is ((p - 1) / 2) rounded down to the nearest integer.

Note that p and q can't actually be left in the formulas. You need to replace p and q with whatever intereger results from the calculations.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rocky
Posted : Wednesday, October 3, 2018 11:52:19 AM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

Yes both formulas worked for me.  I now want test the TC2k version that is already available in SF4.  I did use both formulas above in TC2K.  Since the default DPO in TC2K goes in the same direction as price (SF4 version goes down if price is going up and up if the price is going down)  I want to test the default TC2K version in SF4)

I can do formulas pretty well in TC2K but not so well in SF4.  I hope I am making sense as to my request

rocky
Posted : Wednesday, October 3, 2018 12:01:55 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54
Sorry Bruce. I meant to state in my second sentence the DPO that is already available in TC2K not SF4.
Bruce_L
Posted : Wednesday, October 3, 2018 1:11:52 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I had forgotten how many improvement SF5 added to RealCode. Please try the folloing RC Indicator. You will need to manually edit the value of the Period variable in the RealCode.

RealCode for Real People: Indicators (6:05)

Static Period As Integer = 21
Static MAshift As Integer = System.Math.Ceiling(Period / 2) + 1
Static Sum As Single
If CurrentIndex > MAshift Then
	Sum += Price.Last(MAshift)
Else If CurrentIndex = MAshift Then
	Sum = Price.Last(MAshift)
End If
If CurrentIndex >= MAshift + Period - 1 Then
	Plot = Price.Last - Sum / Period
	Sum -= Price.Last(MAshift + Period - 1)
Else
	Plot = Single.NaN
End If


-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rocky
Posted : Wednesday, October 3, 2018 3:50:06 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 54

I am grateful to you Bruce

Bruce_L
Posted : Wednesday, October 3, 2018 3:59:14 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.