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 how to draw on tc2000 Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
toltec
Posted : Friday, November 1, 2013 10:10:09 PM
Registered User
Joined: 3/3/2005
Posts: 11
Bruce_L
Posted : Monday, November 4, 2013 10:16:14 AM


Worden Trainer

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

Select More | Drawing Tools to open the Drawing Tools window. Then click on Regression Line or Regression Channels to left click and drag on the chart between where you want the regression to start and where you want the regression to end.

Using Drawing Tools in TC2000

There is also a Linear Regression Line indicator which you can add to the chart. It has a period setting and just draws a linear regression line with that period for the newest available data.

Adding and Moving Indicators



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
dtwchu
Posted : Monday, January 13, 2014 2:55:07 AM
Registered User
Joined: 2/10/2010
Posts: 26

Is there a way to create a new indicator showing the difference of a moving linear regression to a simple moving average.  For example MLR(20)-AvgC20.  MLR(20) being the 20 period moving linear regression.

Thanks. 

Bruce_L
Posted : Monday, January 13, 2014 11:17:29 AM


Worden Trainer

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

An Indicator Formula for a 20-period moving linear regression can be written as:

AVGC20 + 9.5 * (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

While an Indicator Formula for a 20-period simple moving average can be written as:

AVGC20

Note that AVGC20 is actually part of the Indicator Formula for the moving linear regression. We can just take that part away to get the difference.

9.5 * (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

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
dtwchu
Posted : Tuesday, January 14, 2014 12:09:02 AM
Registered User
Joined: 2/10/2010
Posts: 26

Thanks for the quick response as always.  However, I do have some additional questions.  I was hoping to have a simpler way to express that in pcf, such as MLR(20) - AvgC20 so that I can experiement by change the period to 30 or other periods.  However, if you can explain how to construct the moving linear regression, such as how you determine the various constants, then may be I can figure it out for various periods on my own.  Thanks again for your help and such fast customer response.  

Bruce_L
Posted : Tuesday, January 14, 2014 10:23:23 AM


Worden Trainer

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

There is no built in syntax for linear regressions in the Personal Criteria Formula Language. The Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis topic referenced in my last response explores how to create formulas involving linear regression.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tradeblazer
Posted : Wednesday, March 6, 2019 8:15:03 AM
Registered User
Joined: 10/16/2018
Posts: 5

For the Regression Channel drawing, I am not sure when dragging it from a start point to an end point if it is a correct channel as placement of the three lines is a little figity.  I am trying to get a moving standard deviation channel  +/- 2 standard deviations based on a prior 21 period.  Is there any function on TC 2000 that will draw this channel to spec and keep drawing it in real time?

 

Thank you.  

Bruce_L
Posted : Wednesday, March 6, 2019 10:14:26 AM


Worden Trainer

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

No, there isn't a way to make the drawing tool work like an indicator and automatically draw a 21 period version that ends at the right edge of the chart.

When I am drawing something which requires a specific number of bars on the chart (or if I just need to quickly count back a certain number of bars on the chart), I usually add the Linear Regression Line indicator to the chart with the period set to the desired number of bars. This allows you to use it as a guide to where the left edge should start when adding your drawing tool for example.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tradeblazer
Posted : Thursday, March 7, 2019 12:12:34 AM
Registered User
Joined: 10/16/2018
Posts: 5

Thanks Bruce.  So then for example, on a 5 minute bar chart, I counted 21 bars back from the close, and started the regression mean line at the open of the first of the 21 bars, dragging it right to the close.  Is this correct way to do what you explained, and will this stay updated in real time?

 

Thank you

Bruce_L
Posted : Thursday, March 7, 2019 9:40:42 AM


Worden Trainer

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

It is the correct way to do what I explained (this is done more easily by have the linea regression line indicator already plotted on the chart as a guide).

As noted in the previous response however, this will not automatically update to keep drawing a 21 bar versions which ends at the right edge of the chart as new bars form. You would have to redraw this every five minutes as each new bar formed to keep keep the drawing tool version (which is the only version with the channels) current.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tradeblazer
Posted : Friday, March 8, 2019 3:18:16 PM
Registered User
Joined: 10/16/2018
Posts: 5

So is there a formula that I can create so that on each chart, I can see lines that will always be +/- 2 SD away from the rgression line?  This is important for me, and I have been shown that other charting softwares have SD channels as an added indicator.  

 

Thanks.

 

 

Bruce_L
Posted : Friday, March 8, 2019 3:55:18 PM


Worden Trainer

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

No, there isn't a formula you can use. We could add such lines to a moving linear regression indicator but not to the linear regression line indicator.



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