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 Slope and R-Squared Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Al_Gorithm
Posted : Tuesday, May 8, 2018 11:56:10 AM

Registered User
Joined: 6/30/2017
Posts: 1,227

Hi Bruce,

I know there's a template somewhere around here (if you give me the link I'll bookmark it for next time) but for now ... there's a new barista today and she's cute. ;)

What are the PCFs for a 34-period Linear Regression Slope and a 34-period Linear Regression R-Squared? I'd like to plot them, and add them as value columns. Eventually I might use them as condition columns, depending on the setup.

Thanks!

Bruce_L
Posted : Tuesday, May 8, 2018 12:05:12 PM


Worden Trainer

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

The following would be the 45 period linear regression slope.

6 * (FAVG(C,45) - AVG(C, 45)) / (45 - 1)

The following would be the 45 period annualized regression slope.

100 * (EXP(253 * 6 * (FAVG(LOG(C ), 45) - AVG(LOG(C ), 45)) / (45 - 1)) - 1)

And the following would be the 45 period R-Squared.

((45 + 1) / 2 * (FAVG(C, 45) - AVG(C, 45)) / SQR((45 ^ 2 - 1) * (AVG((C ) ^ 2, 45) - AVG(C, 45) ^ 2) / 12)) ^ 2

You can change all instances of 45 in the formulas to change the period. And you can replace all instances of C with something else if you want the values to be based on something besides closing prices.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Al_Gorithm
Posted : Tuesday, May 8, 2018 12:57:52 PM

Registered User
Joined: 6/30/2017
Posts: 1,227

Awesome, Bruce. Thanks!

If the barista has a sister, I'll let you know.

Bruce_L
Posted : Tuesday, May 8, 2018 1:06:10 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.