## New version 17 available now

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

New account application Trading resources
Margin rates Stock & option commissions

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

 Linear Regression of a 20 SMA Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
mnm
 Posted : Monday, March 20, 2017 2:01:24 PM
Gold Customer

Joined: 6/23/2010
Posts: 8

I am trying to write a pcf for the percentage change (not annualized) of a 6 period linear regression line applied to a 20 period simple moving average. Can you tell me if this formula is correct?

100 * (EXP((2.5 * LOG(AVGC20 ) + 1.5 * LOG(AVGC20.1) + .5 * LOG(AVGC20.2) - .5 * LOG(AVGC20.3) - 1.5 * LOG(AVGC20.4) - 2.5 * LOG(AVGC20.5)) / 17.5) - 1)

Thank you

Bruce_L
 Posted : Monday, March 20, 2017 2:34:12 PM

Worden Trainer

Joined: 10/7/2004
Posts: 61,012

If you aren't trying to annualize it and are using TC2000 v17, you could use the following.

AVG(3 * FAVGC6 - 2 * AVGC6, 20)

Note that the 6 period moving linear regression of the 20 period simple moving average is the same as the 20 period simple moving average of the 6 period moving linear regression which is why were able to write the formula as given above. This is slightly shorter than writing it the other way round.

3 * FAVG(AVGC20, 6) - 2 * AVG(AVGC20, 6)

This could be written as follows in earlier versions of TC2000.

AVG(AVGC20, 6) + 2.5 * (2.5 * AVGC20 + 1.5 * AVGC20.1 + .5 * AVGC20.2 - .5 * AVGC20.3 - 1.5 * AVGC20.4 - 2.5 * AVGC20.5) / 17.5

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mnm
 Posted : Monday, March 20, 2017 3:29:14 PM
Gold Customer

Joined: 6/23/2010
Posts: 8

Thanks Bruce.

Can you also tell me the PCF for the start and end points for a standard (non-moving) linear regression line? For example, a linear regression line applied to 20 bars of price history.

I&rsquo;m thinking the starting point is the C of 20 bars ago?? I am having a hard time interpreting these formulas.

Bruce_L
 Posted : Monday, March 20, 2017 4:43:21 PM

Worden Trainer

Joined: 10/7/2004
Posts: 61,012

The starting point of a 20 period linear regression line is actually 19 bars ago since it is 20 bars long and includes the current bar (which is 0 bars ago).

The left end point (starting point) of a 20 period linear regression line of price will have the following value.

4 * AVGC20 - 3 * FAVGC20

And the right end point of a 20 period linear regerssion line of price will have the following value.

3 * FAVGC20 - 2 * AVGC20

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mnm
 Posted : Monday, March 20, 2017 5:10:50 PM
Gold Customer

Joined: 6/23/2010
Posts: 8

Perfect - Thank you Bruce

Bruce_L
 Posted : Tuesday, March 21, 2017 9:06:14 AM

Worden Trainer

Joined: 10/7/2004
Posts: 61,012

You're welcome.

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

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/17 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 17 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos 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.