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 |

Linear Regression Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
warrenshepherd
Posted : Saturday, June 16, 2012 4:52:22 PM
Gold Customer Gold Customer

Joined: 12/21/2004
Posts: 13

Sirs, I use the linear regression to make some judgements on stocks, both 3 month and 4 month linear regressions.  I want to get the slope of those regression lines and use them in scans to select stocks. 

 

Can you tell me how to write the formula for the slope of the linear regression line created by the Worden software or how I can obtain that value to use in my scans?

The slope should be the number that is the ratio of the 'rise over run', and consequently, its number will be the value of dollars gained in the stock per each day of trading, as measured by the linear regression.

 

thank you for your assistance........warren shepherd

Bruce_L
Posted : Monday, June 18, 2012 7:48:17 AM


Worden Trainer

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

An Indicator Formula for the slope of a 63-Period Linear Regression Line (about 3-months on a Daily Chart) would be:

(31 * C + 30 * C1 + 29 * C2 + 28 * C3 + 27 * C4 + 26 * C5 + 25 * C6 + 24 * C7 + 23 * C8 + 22 * C9 + 21 * C10 + 20 * C11 + 19 * C12 + 18 * C13 + 17 * C14 + 16 * C15 + 15 * C16 + 14 * C17 + 13 * C18 + 12 * C19 + 11 * C20 + 10 * C21 + 9 * C22 + 8 * C23 + 7 * C24 + 6 * C25 + 5 * C26 + 4 * C27 + 3 * C28 + 2 * C29 + C30 - C32 - 2 * C33 - 3 * C34 - 4 * C35 - 5 * C36 - 6 * C37 - 7 * C38 - 8 * C39 - 9 * C40 - 10 * C41 - 11 * C42 - 12 * C43 - 13 * C44 - 14 * C45 - 15 * C46 - 16 * C47 - 17 * C48 - 18 * C49 - 19 * C50 - 20 * C51 - 21 * C52 - 22 * C53 - 23 * C54 - 24 * C55 - 25 * C56 - 26 * C57 - 27 * C58 - 28 * C59 - 29 * C60 - 30 * C61 - 31 * C62) / 20832

An Indicator Formula for the slope of a 84-Period Linear Regression Line (about 4-months on a Daily Chart) would be:

(41.5 * C + 40.5 * C1 + 39.5 * C2 + 38.5 * C3 + 37.5 * C4 + 36.5 * C5 + 35.5 * C6 + 34.5 * C7 + 33.5 * C8 + 32.5 * C9 + 31.5 * C10 + 30.5 * C11 + 29.5 * C12 + 28.5 * C13 + 27.5 * C14 + 26.5 * C15 + 25.5 * C16 + 24.5 * C17 + 23.5 * C18 + 22.5 * C19 + 21.5 * C20 + 20.5 * C21 + 19.5 * C22 + 18.5 * C23 + 17.5 * C24 + 16.5 * C25 + 15.5 * C26 + 14.5 * C27 + 13.5 * C28 + 12.5 * C29 + 11.5 * C30 + 10.5 * C31 + 9.5 * C32 + 8.5 * C33 + 7.5 * C34 + 6.5 * C35 + 5.5 * C36 + 4.5 * C37 + 3.5 * C38 + 2.5 * C39 + 1.5 * C40 + .5 * C41 - .5 * C42 - 1.5 * C43 - 2.5 * C44 - 3.5 * C45 - 4.5 * C46 - 5.5 * C47 - 6.5 * C48 - 7.5 * C49 - 8.5 * C50 - 9.5 * C51 - 10.5 * C52 - 11.5 * C53 - 12.5 * C54 - 13.5 * C55 - 14.5 * C56 - 15.5 * C57 - 16.5 * C58 - 17.5 * C59 - 18.5 * C60 - 19.5 * C61 - 20.5 * C62 - 21.5 * C63 - 22.5 * C64 - 23.5 * C65 - 24.5 * C66 - 25.5 * C67 - 26.5 * C68 - 27.5 * C69 - 28.5 * C70 - 29.5 * C71 - 30.5 * C72 - 31.5 * C73 - 32.5 * C74 - 33.5 * C75 - 34.5 * C76 - 35.5 * C77 - 36.5 * C78 - 37.5 * C79 - 38.5 * C80 - 39.5 * C81 - 40.5 * C82 - 41.5 * C83) / 49385

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jadeluca
Posted : Friday, January 4, 2013 2:40:24 PM
Registered User
Joined: 5/9/2011
Posts: 80

Bruce,

I have searched the database for previous LRL-SLOPE equations you have written already.

I am looking to find on for a 75 day period that goes with a 25 day period. Would you have produced 

these equations already? Both equations are for CLOSE of Price.

Jim

Bruce_L
Posted : Friday, January 4, 2013 2:53:32 PM


Worden Trainer

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

An Indicator Formula for the slope of a 75-Period Linear Regression Line could be written as:

(37 * C + 36 * C1 + 35 * C2 + 34 * C3 + 33 * C4 + 32 * C5 + 31 * C6 + 30 * C7 + 29 * C8 + 28 * C9 + 27 * C10 + 26 * C11 + 25 * C12 + 24 * C13 + 23 * C14 + 22 * C15 + 21 * C16 + 20 * C17 + 19 * C18 + 18 * C19 + 17 * C20 + 16 * C21 + 15 * C22 + 14 * C23 + 13 * C24 + 12 * C25 + 11 * C26 + 10 * C27 + 9 * C28 + 8 * C29 + 7 * C30 + 6 * C31 + 5 * C32 + 4 * C33 + 3 * C34 + 2 * C35 + C36 - C38 - 2 * C39 - 3 * C40 - 4 * C41 - 5 * C42 - 6 * C43 - 7 * C44 - 8 * C45 - 9 * C46 - 10 * C47 - 11 * C48 - 12 * C49 - 13 * C50 - 14 * C51 - 15 * C52 - 16 * C53 - 17 * C54 - 18 * C55 - 19 * C56 - 20 * C57 - 21 * C58 - 22 * C59 - 23 * C60 - 24 * C61 - 25 * C62 - 26 * C63 - 27 * C64 - 28 * C65 - 29 * C66 - 30 * C67 - 31 * C68 - 32 * C69 - 33 * C70 - 34 * C71 - 35 * C72 - 36 * C73 - 37 * C74) / 35150

An Indicator Formula for the slope of a 25-Period Linear Regression Line could be written as:

(12 * C + 11 * C1 + 10 * C2 + 9 * C3 + 8 * C4 + 7 * C5 + 6 * C6 + 5 * C7 + 4 * C8 + 3 * C9 + 2 * C10 + C11 - C13 - 2 * C14 - 3 * C15 - 4 * C16 - 5 * C17 - 6 * C18 - 7 * C19 - 8 * C20 - 9 * C21 - 10 * C22 - 11 * C23 - 12 * C24) / 1300



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jadeluca
Posted : Friday, January 4, 2013 5:33:50 PM
Registered User
Joined: 5/9/2011
Posts: 80

Bruce,

Your service is simply the Best... Thank you,

Jim

sloop22
Posted : Monday, January 14, 2013 10:10:49 AM
Registered User
Joined: 12/5/2007
Posts: 29

Dear Trainer

Using the example

An Indicator Formula for the slope of a 25-Period Linear Regression Line could be written as:

(12 * C + 11 * C1 + 10 * C2 + 9 * C3 + 8 * C4 + 7 * C5 + 6 * C6 + 5 * C7 + 4 * C8 + 3 * C9 + 2 * C10 + C11 - C13 - 2 * C14 - 3 * C15 - 4 * C16 - 5 * C17 - 6 * C18 - 7 * C19 - 8 * C20 - 9 * C21 - 10 * C22 - 11 * C23 - 12 * C24) / 1300

1. How is the divisor calculated for this or any other period.

2.In above example and other lenths of Linerar regression can other functions be substuted for C such as L, Min, MAX, AVG, XAVG,XAVG(XAVGC10,).

Hope I made myself clear, not a math guy.

Thank You, at your convience

Jeff

Bruce_L
Posted : Monday, January 14, 2013 10:43:13 AM


Worden Trainer

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

The Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis topic referenced in my first post explores the calculations of the divisor in the formula in a variety of ways. The most succinct would probably be a formula given in bustermu's Tuesday, April 04, 2006 12:12:34 PM ET post in the topic (the post itself is not short, but the formula is).

P*(P^2-1)/12

So we would get:

25 * (25 ^ 2 - 1) / 12

25 * (625 - 1) / 12

25 * 624 / 12

15600 / 12

1300

Yes, you can in general substitute other bars ago versions of indicators into the linear regression slope formula besides C to get the linear regression slope of something other than closing prices. The exact details of doing so would depend on the specific indicator for which you wanted to create a linear regression slope formula. In some cases, the resulting formula would be too long and slow to be practical or post in the forums.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
sloop22
Posted : Monday, January 14, 2013 11:41:36 AM
Registered User
Joined: 12/5/2007
Posts: 29

Bruce

Thank you very much, I did read the post, just a little too overwhelming for me 

This helps,P*(P^2-1)/12

I'll figure the rest out on my own, there is enought information, for me to run with. 

 

Best to You

Jeff

Bruce_L
Posted : Monday, January 14, 2013 11:45:50 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.