Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

slope of the regression line Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
chaid_guevara
Posted : Monday, June 23, 2014 6:06:47 PM
Registered User
Joined: 12/31/2004
Posts: 36

Hi

I am trying to normalize and smooth rankings of stocks and ETFs by using the slope of the regression line.  You have given me a 20 period slope (below) and 35 period slope.  Can I please have a 10 period slope and 40 period slope 

Thanks in advance --  wish there was some place where I could learn this code.

(9.5 * C + 8.5 * C1 + 7.5 * C2 + 6.5 * C3 + 5.5 * C4 + 4.5 * C5 + 3.5 * C6 + 2.5 * C7 + 1.5 * C8 + .5 * C9 - .5 * C10 - 1.5 * C11 - 2.5 * C12 - 3.5 * C13 - 4.5 * C14 - 5.5 * C15 - 6.5 * C16 - 7.5 * C17 - 8.5 * C18 - 9.5 * C19) / 665

Bruce_L
Posted : Tuesday, June 24, 2014 8:37:09 AM


Worden Trainer

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

The Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis explores how to create linear regression related Personal Criteria Fomulas.

The slope of the 10-period linear regression line can be written as follows.

(4.5 * C + 3.5 * C1 + 2.5 * C2 + 1.5 * C3 + .5 * C4 - .5 * C5 - 1.5 * C6 - 2.5 * C7 - 3.5 * C8 - 4.5 * C9) / 82.5

The slope of the 40-period linear regression line can be written as follows.

(19.5 * C + 18.5 * C1 + 17.5 * C2 + 16.5 * C3 + 15.5 * C4 + 14.5 * C5 + 13.5 * C6 + 12.5 * C7 + 11.5 * C8 + 10.5 * C9 + 9.5 * C10 + 8.5 * C11 + 7.5 * C12 + 6.5 * C13 + 5.5 * C14 + 4.5 * C15 + 3.5 * C16 + 2.5 * C17 + 1.5 * C18 + .5 * C19 - .5 * C20 - 1.5 * C21 - 2.5 * C22 - 3.5 * C23 - 4.5 * C24 - 5.5 * C25 - 6.5 * C26 - 7.5 * C27 - 8.5 * C28 - 9.5 * C29 - 10.5 * C30 - 11.5 * C31 - 12.5 * C32 - 13.5 * C33 - 14.5 * C34 - 15.5 * C35 - 16.5 * C36 - 17.5 * C37 - 18.5 * C38 - 19.5 * C39) / 5330



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
chaid_guevara
Posted : Tuesday, June 24, 2014 2:47:49 PM
Registered User
Joined: 12/31/2004
Posts: 36

Bruce 

 

Thank you very much 

 

Bob

chaid_guevara
Posted : Wednesday, January 28, 2015 5:23:56 PM
Registered User
Joined: 12/31/2004
Posts: 36

I have been trying to plot the slope of three regression lines, a 10 day, a 20 day and a 40 day line.  For some reason, I can’t get the plots to appear,  I want to test the cross overs as signals for buy and sell

Data source - linear regression 40

Period - 39 days (however the period does not seem to have an effect when the data source is 39 or 1 day.

(19.5 * C + 18.5 * C1 + 17.5 * C2 + 16.5 * C3 + 15.5 * C4 + 14.5 * C5 + 13.5 * C6 + 12.5 * C7 + 11.5 * C8 + 10.5 * C9 + 9.5 * C10 + 8.5 * C11 + 7.5 * C12 + 6.5 * C13 + 5.5 * C14 + 4.5 * C15 + 3.5 * C16 + 2.5 * C17 + 1.5 * C18 + .5 * C19 - .5 * C20 - 1.5 * C21 - 2.5 * C22 - 3.5 * C23 - 4.5 * C24 - 5.5 * C25 - 6.5 * C26 - 7.5 * C27 - 8.5 * C28 - 9.5 * C29 - 10.5 * C30 - 11.5 * C31 - 12.5 * C32 - 13.5 * C33 - 14.5 * C34 - 15.5 * C35 - 16.5 * C36 - 17.5 * C37 - 18.5 * C38 - 19.5 * C39) / 5330

 

20 day

Data source linear regression 20

(9.5 * C + 8.5 * C1 + 7.5 * C2 + 6.5 * C3 + 5.5 * C4 + 4.5 * C5 + 3.5 * C6 + 2.5 * C7 + 1.5 * C8 + .5 * C9 - .5 * C10 - 1.5 * C11 - 2.5 * C12 - 3.5 * C13 - 4.5 * C14 - 5.5 * C15 - 6.5 * C16 - 7.5 * C17 - 8.5 * C18 - 9.5 * C19) / 665

 

10 day

Data source linear regression 10

(4.5 * C + 3.5 * C1 + 2.5 * C2 + 1.5 * C3 + .5 * C4 - .5 * C5 - 1.5 * C6 - 2.5 * C7 - 3.5 * C8 - 4.5 * C9) / 82.5

 

 

Any ideas as to what I am doing wrong??

Bruce_L
Posted : Thursday, January 29, 2015 1:28:52 PM


Worden Trainer

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

I think the problem is with setting the data source to the linear regression line. You need to just leave this set to Price History.

Select Add Plot to Chart (the green + in the upper left of the chart) and choose Custom PCF Indicator from the list. Then click on the name of the Custom PCF Indicator (It probably starts with the word Formula) at the top of the pane where it is plotted end select Edit so you can use the following settings.

- Period: 1
- Average Type: Doesn't matter (because the period is 1).
- Formula: One of your formulas from above.
- Data Source: Price History

Make sure you are putting all of the Custom PCF Indicators in the same pane or you won't be able to create conditions comparing them when clicking on one of the indicators and selecting Create Scan Condition.

Indicator Scaling (2:38)
Create Conditions from Your Chart (5:25)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
chaid_guevara
Posted : Thursday, January 29, 2015 6:35:49 PM
Registered User
Joined: 12/31/2004
Posts: 36

Thanks Bruce

Bruce_L
Posted : Friday, January 30, 2015 9:51:29 AM


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.