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 |

MACD linear regression pcf help Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jlin827
Posted : Thursday, March 2, 2006 5:28:46 PM
Registered User
Joined: 5/20/2005
Posts: 178
Dear trainer,

I understand it is too hard/long to write a pcf on MACD divergence from price.
However, is it possible to write a pcf on the linear regression 21 on the MACD(10,21,7) and to show divergence from price that way?

Thanks

james
jlin827
Posted : Thursday, March 2, 2006 5:31:42 PM
Registered User
Joined: 5/20/2005
Posts: 178
and how about a linear regression 21 on price?
can you also write a pcf on that?

james
Bruce_L
Posted : Thursday, March 2, 2006 6:29:47 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Here's one way to write a 21-Period Linear Regression of Price:

AVGC21 + 10 * (10 * C + 9 * C1 + 8 * C2 + 7 * C3 + 6 * C4 + 5 * C5 + 4 * C6 + 3 * C7 + 2 * C8 + C9 - C11 - 2 * C12 - 3 * C13 - 4 * C14 - 5 * C15 - 6 * C16 - 7 * C17 - 8 * C18 - 9 * C19 - 10 * C20) / 770

If you are interested in divergences, you are actually probably interested in the slope instead of the endpoint (which is just the last part of the formula):

(10 * C + 9 * C1 + 8 * C2 + 7 * C3 + 6 * C4 + 5 * C5 + 4 * C6 + 3 * C7 + 2 * C8 + C9 - C11 - 2 * C12 - 3 * C13 - 4 * C14 - 5 * C15 - 6 * C16 - 7 * C17 - 8 * C18 - 9 * C19 - 10 * C20) / 770

Do you want the MACD Linear Regression Formula to be of the MACD, the Trigger Line or the Histogram? Do you want the Linear Regression endpoint or slope?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jlin827
Posted : Tuesday, March 7, 2006 1:08:48 AM
Registered User
Joined: 5/20/2005
Posts: 178
Thanks bruce,
i believewould like the MACD linear regression formula to be of the MACD.
What is the trigger line?

a question about the formula, why divide by 770?

james
Bruce_L
Posted : Tuesday, March 7, 2006 9:17:42 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Here's one way to write a 21-Period Linear Regression of the raw Exponential MACD Line:

AVG(XAVGC10,21) - AVG(XAVGC21,21) + 10 * (10 * (XAVGC10 - XAVGC21) + 9 * (XAVGC10.1 - XAVGC21.1) + 8 * (XAVGC10.2 - XAVGC21.2) + 7 * (XAVGC10.3 - XAVGC21.3) + 6 * (XAVGC10.4 - XAVGC21.4) + 5 * (XAVGC10.5 - XAVGC21.5) + 4 * (XAVGC10.6 - XAVGC21.6) + 3 * (XAVGC10.7 - XAVGC21.7) + 2 * (XAVGC10.8 - XAVGC21.8) + (XAVGC10.9 - XAVGC21.9) - (XAVGC10.11 - XAVGC21.11) - 2 * (XAVGC10.12 - XAVGC21.12) - 3 * (XAVGC10.13 - XAVGC21.13) - 4 * (XAVGC10.14 - XAVGC21.14) - 5 * (XAVGC10.15 - XAVGC21.15) - 6 * (XAVGC10.16 - XAVGC21.16) - 7 * (XAVGC10.17 - XAVGC21.17) - 8 * (XAVGC10.18 - XAVGC21.18) - 9 * (XAVGC10.19 - XAVGC21.19) - 10 * (XAVGC10.20 - XAVGC21.20)) / 770

Here's the slope portion:

(10 * (XAVGC10 - XAVGC21) + 9 * (XAVGC10.1 - XAVGC21.1) + 8 * (XAVGC10.2 - XAVGC21.2) + 7 * (XAVGC10.3 - XAVGC21.3) + 6 * (XAVGC10.4 - XAVGC21.4) + 5 * (XAVGC10.5 - XAVGC21.5) + 4 * (XAVGC10.6 - XAVGC21.6) + 3 * (XAVGC10.7 - XAVGC21.7) + 2 * (XAVGC10.8 - XAVGC21.8) + (XAVGC10.9 - XAVGC21.9) - (XAVGC10.11 - XAVGC21.11) - 2 * (XAVGC10.12 - XAVGC21.12) - 3 * (XAVGC10.13 - XAVGC21.13) - 4 * (XAVGC10.14 - XAVGC21.14) - 5 * (XAVGC10.15 - XAVGC21.15) - 6 * (XAVGC10.16 - XAVGC21.16) - 7 * (XAVGC10.17 - XAVGC21.17) - 8 * (XAVGC10.18 - XAVGC21.18) - 9 * (XAVGC10.19 - XAVGC21.19) - 10 * (XAVGC10.20 - XAVGC21.20)) / 770

770 is the sum of the squares of the coefficients.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jlin827
Posted : Thursday, March 23, 2006 2:27:37 AM
Registered User
Joined: 5/20/2005
Posts: 178
Dear Bruce,

Thank you for the formula.
What are the differences of using endpoint or slope formula? (i am trying to find the divergence on stock price and technical indicators, both positive and negative divergences)

james
jlin827
Posted : Thursday, March 23, 2006 2:34:16 AM
Registered User
Joined: 5/20/2005
Posts: 178
Bruce,

I have recently changed my settings on the MACD. Instead of MACD(10,21,7), i am using MACD(5,21,5).
If i want to adjusting the setting changes to the pcfs you wrote, is it correct that all i need to change is replacing all XAVGC10 to XAVGC5?
and that i still dont understand how did you get 770. can you explain that more in detail?

Thanks again

james
Bruce_L
Posted : Thursday, March 23, 2006 7:43:26 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
jlin827,
Since the Linear Regression Period didn't change, that should work:

Here's one way to write a 21-Period Linear Regression of the raw Exponential MACD Line:

AVG(XAVGC5,21) - AVG(XAVGC21,21) + 10 * (10 * (XAVGC5 - XAVGC21) + 9 * (XAVGC5.1 - XAVGC21.1) + 8 * (XAVGC5.2 - XAVGC21.2) + 7 * (XAVGC5.3 - XAVGC21.3) + 6 * (XAVGC5.4 - XAVGC21.4) + 5 * (XAVGC5.5 - XAVGC21.5) + 4 * (XAVGC5.6 - XAVGC21.6) + 3 * (XAVGC5.7 - XAVGC21.7) + 2 * (XAVGC5.8 - XAVGC21.8) + (XAVGC5.9 - XAVGC21.9) - (XAVGC5.11 - XAVGC21.11) - 2 * (XAVGC5.12 - XAVGC21.12) - 3 * (XAVGC5.13 - XAVGC21.13) - 4 * (XAVGC5.14 - XAVGC21.14) - 5 * (XAVGC5.15 - XAVGC21.15) - 6 * (XAVGC5.16 - XAVGC21.16) - 7 * (XAVGC5.17 - XAVGC21.17) - 8 * (XAVGC5.18 - XAVGC21.18) - 9 * (XAVGC5.19 - XAVGC21.19) - 10 * (XAVGC5.20 - XAVGC21.20)) / 770

Here's the slope portion:

(10 * (XAVGC5 - XAVGC21) + 9 * (XAVGC5.1 - XAVGC21.1) + 8 * (XAVGC5.2 - XAVGC21.2) + 7 * (XAVGC5.3 - XAVGC21.3) + 6 * (XAVGC5.4 - XAVGC21.4) + 5 * (XAVGC5.5 - XAVGC21.5) + 4 * (XAVGC5.6 - XAVGC21.6) + 3 * (XAVGC5.7 - XAVGC21.7) + 2 * (XAVGC5.8 - XAVGC21.8) + (XAVGC5.9 - XAVGC21.9) - (XAVGC5.11 - XAVGC21.11) - 2 * (XAVGC5.12 - XAVGC21.12) - 3 * (XAVGC5.13 - XAVGC21.13) - 4 * (XAVGC5.14 - XAVGC21.14) - 5 * (XAVGC5.15 - XAVGC21.15) - 6 * (XAVGC5.16 - XAVGC21.16) - 7 * (XAVGC5.17 - XAVGC21.17) - 8 * (XAVGC5.18 - XAVGC21.18) - 9 * (XAVGC5.19 - XAVGC21.19) - 10 * (XAVGC5.20 - XAVGC21.20)) / 770

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