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

standard Dev Channel and Linear Regression Channel PCFs help in version 7 Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jlin827
Posted : Friday, August 8, 2014 9:15:38 AM
Registered User
Joined: 5/20/2005
Posts: 178

Dear Trainer,

I use thinkorswim charting service in addition to tc2000.  I use its StandardDevChannel and LinearRegCh100 on Monthly chart to spot stocks have have been way oversold.  

I tried to find their setting on thinkorswim. for StandardDevChannel, its settings are 1 standard deviation and its length is 21 months.  for LinearRegChannel, there is no setting values i was able to find other than it is using monthly close price for its calculations.

I wonder if it is possible to write two pcfs,  one to find stocks that are trading below its monthly lower linear regression channel 100 and to find stocks that are trading below their monthly lower standard deviation channel.  

I understand it is probably very difficult or take too much calculations to do the pcfs.  However, I do not need them to be that exact.  are there ways to write simple pcfs which will find stocks below the two channels that might produce similar results?

Thank you for your time,

james

Bruce_L
Posted : Friday, August 8, 2014 4:56:22 PM


Worden Trainer

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

A Personal Criteria Formula for price being more than 1 standard deviation below its 21-period linear regression line on a monthly chart can be written as follows.

C < ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420) / 21) + 10 * (10 * (C - C420) + 9 * (C21 - C399) + 8 * (C42 - C378) + 7 * (C63 - C357) + 6 * (C84 - C336) + 5 * (C105 - C315) + 4 * (C126 - C294) + 3 * (C147 - C273) + 2 * (C168 - C252) + C189 - C231) / 770 - SQR(ABS(C ^ 2 + C21 ^ 2 + C42 ^ 2 + C63 ^ 2 + C84 ^ 2 + C105 ^ 2 + C126 ^ 2 + C147 ^ 2 + C168 ^ 2 + C189 ^ 2 + C210 ^ 2 + C231 ^ 2 + C252 ^ 2 + C273 ^ 2 + C294 ^ 2 + C315 ^ 2 + C336 ^ 2 + C357 ^ 2 + C378 ^ 2 + C399 ^ 2 + C420 ^ 2 - 21 * ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420) / 21) ^ 2) / 21)

There is no way to create a Personal Criteria Formula which is short enough to be practical or post in the forums for price being below anything similar to the LinearRegCh100 indicator in ThinkOrSwim.

According to the ThinkOrSwim website, this indicator checks for the largest distance between price and the Linear Regression Channel and then using this value as the distance away from the Linear Regression Line that it would plot its upper and lower channels. It should have an option to set a period, so I do not know why you would not see this setting.

This would involve calculating the value of the linear regression line at each point, determining the absolute value of the difference between the linear regression line and then calculating the maximum value of these absolute differences. This would result in a formula which is many, many thousands of characters long.

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
Modelling Bollinger Bands (& Standard Deviation) in a TC PCF
Linear regression channel calculations



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jlin827
Posted : Saturday, August 9, 2014 12:35:02 AM
Registered User
Joined: 5/20/2005
Posts: 178

Thanks Bruce for taking the time to look into this subject, guess its too difficult to write pcfs on Linear Regression Lines.  

 

Bruce_L
Posted : Saturday, August 9, 2014 9:56:39 AM


Worden Trainer

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

The Linear Regression Line is not a problem as demonstrated by the Condition Formula created for price being 1 standard deviation below the Linear Regression Line.

The problem is the width calculations for the the LinearRegCh100 indicator. It requires both calculated the distance between the linear regression line at every single point along that linear regression line and calculating the maximum of the absolute values of all of these distances.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
jlin827
Posted : Saturday, August 9, 2014 11:30:57 PM
Registered User
Joined: 5/20/2005
Posts: 178

Dear Bruce,

PERSONAL Criteria Formula for price being more than 1 standard deviation below its 21-period linear regression line on a monthly chart can be written as follows.

C < ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420) / 21) + 10 * (10 * (C - C420) + 9 * (C21 - C399) + 8 * (C42 - C378) + 7 * (C63 - C357) + 6 * (C84 - C336) + 5 * (C105 - C315) + 4 * (C126 - C294) + 3 * (C147 - C273) + 2 * (C168 - C252) + C189 - C231) / 770 - SQR(ABS(C ^ 2 + C21 ^ 2 + C42 ^ 2 + C63 ^ 2 + C84 ^ 2 + C105 ^ 2 + C126 ^ 2 + C147 ^ 2 + C168 ^ 2 + C189 ^ 2 + C210 ^ 2 + C231 ^ 2 + C252 ^ 2 + C273 ^ 2 + C294 ^ 2 + C315 ^ 2 + C336 ^ 2 + C357 ^ 2 + C378 ^ 2 + C399 ^ 2 + C420 ^ 2 - 21 * ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420) / 21) ^ 2) / 21)

I tested this pcf, but it does not give me the results i wanted.  

I was hoping to find stocks (like COH and LULU) that are close to or at their multi-year low and are below their Linear regression lower channel(100,0,20) on weekly and monthly charts (since tc2000 does not have standard deviation channel that can be plotted on a chart)

 

Bruce_L
Posted : Monday, August 11, 2014 2:10:52 PM


Worden Trainer

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

All the formula tests for is if price is more than 1 standard deviation below its 21-period linear regression line on a monthly chart.

This does not necessarily mean a stock is at a multi-year low although it can be the case. COH currently meets the requirements of the condition and LULU recently met the requirements of the condition.

You can directly check for the most recent daily bar being a two year low using something like the following:

L = MINL504

Checking for the weekly bar to be the low could be done as follows.

MINL5 = MINL504

And checking for the monthly bar to be the low would be similar.

MINL21 = MINL504

The three formulas above all would require at least 504 trading days of data be available for the symbol in order to calculate. So it could not return true for symbols with fewer than 504 bars of daily data.

A Condition Formula to check for price being below its own weekly and monthly Linear Regression Channel 100, 0, 20 ends up being way too long to be practical or post in the forums. That said, we can create a Condition Formula for price being at least 2 standard deviations below its weekly and monthly 100 period linear regression line even though we can't plot those channels on the chart (although we could do for moving linear regressions).

Warning: Long Personal Criteria Formulas can dramatically increase the time it takes to update your PCFs.

The following Condition Formula requires at least 2079 trading days of data to calculate (more than 8 years). So it cannot return true for symbols with fewer than 2079 trading days of data.

C < ((C + C5 + C10 + C15 + C20 + C25 + C30 + C35 + C40 + C45 + C50 + C55 + C60 + C65 + C70 + C75 + C80 + C85 + C90 + C95 + C100 + C105 + C110 + C115 + C120 + C125 + C130 + C135 + C140 + C145 + C150 + C155 + C160 + C165 + C170 + C175 + C180 + C185 + C190 + C195 + C200 + C205 + C210 + C215 + C220 + C225 + C230 + C235 + C240 + C245 + C250 + C255 + C260 + C265 + C270 + C275 + C280 + C285 + C290 + C295 + C300 + C305 + C310 + C315 + C320 + C325 + C330 + C335 + C340 + C345 + C350 + C355 + C360 + C365 + C370 + C375 + C380 + C385 + C390 + C395 + C400 + C405 + C410 + C415 + C420 + C425 + C430 + C435 + C440 + C445 + C450 + C455 + C460 + C465 + C470 + C475 + C480 + C485 + C490 + C495) / 100) + 49.5 * (49.5 * C + 48.5 * C5 + 47.5 * C10 + 46.5 * C15 + 45.5 * C20 + 44.5 * C25 + 43.5 * C30 + 42.5 * C35 + 41.5 * C40 + 40.5 * C45 + 39.5 * C50 + 38.5 * C55 + 37.5 * C60 + 36.5 * C65 + 35.5 * C70 + 34.5 * C75 + 33.5 * C80 + 32.5 * C85 + 31.5 * C90 + 30.5 * C95 + 29.5 * C100 + 28.5 * C105 + 27.5 * C110 + 26.5 * C115 + 25.5 * C120 + 24.5 * C125 + 23.5 * C130 + 22.5 * C135 + 21.5 * C140 + 20.5 * C145 + 19.5 * C150 + 18.5 * C155 + 17.5 * C160 + 16.5 * C165 + 15.5 * C170 + 14.5 * C175 + 13.5 * C180 + 12.5 * C185 + 11.5 * C190 + 10.5 * C195 + 9.5 * C200 + 8.5 * C205 + 7.5 * C210 + 6.5 * C215 + 5.5 * C220 + 4.5 * C225 + 3.5 * C230 + 2.5 * C235 + 1.5 * C240 + 0.5 * C245 - 0.5 * C250 - 1.5 * C255 - 2.5 * C260 - 3.5 * C265 - 4.5 * C270 - 5.5 * C275 - 6.5 * C280 - 7.5 * C285 - 8.5 * C290 - 9.5 * C295 - 10.5 * C300 - 11.5 * C305 - 12.5 * C310 - 13.5 * C315 - 14.5 * C320 - 15.5 * C325 - 16.5 * C330 - 17.5 * C335 - 18.5 * C340 - 19.5 * C345 - 20.5 * C350 - 21.5 * C355 - 22.5 * C360 - 23.5 * C365 - 24.5 * C370 - 25.5 * C375 - 26.5 * C380 - 27.5 * C385 - 28.5 * C390 - 29.5 * C395 - 30.5 * C400 - 31.5 * C405 - 32.5 * C410 - 33.5 * C415 - 34.5 * C420 - 35.5 * C425 - 36.5 * C430 - 37.5 * C435 - 38.5 * C440 - 39.5 * C445 - 40.5 * C450 - 41.5 * C455 - 42.5 * C460 - 43.5 * C465 - 44.5 * C470 - 45.5 * C475 - 46.5 * C480 - 47.5 * C485 - 48.5 * C490 - 49.5 * C495) / 83325 - 2 * SQR(ABS(C ^ 2 + C5 ^ 2 + C10 ^ 2 + C15 ^ 2 + C20 ^ 2 + C25 ^ 2 + C30 ^ 2 + C35 ^ 2 + C40 ^ 2 + C45 ^ 2 + C50 ^ 2 + C55 ^ 2 + C60 ^ 2 + C65 ^ 2 + C70 ^ 2 + C75 ^ 2 + C80 ^ 2 + C85 ^ 2 + C90 ^ 2 + C95 ^ 2 + C100 ^ 2 + C105 ^ 2 + C110 ^ 2 + C115 ^ 2 + C120 ^ 2 + C125 ^ 2 + C130 ^ 2 + C135 ^ 2 + C140 ^ 2 + C145 ^ 2 + C150 ^ 2 + C155 ^ 2 + C160 ^ 2 + C165 ^ 2 + C170 ^ 2 + C175 ^ 2 + C180 ^ 2 + C185 ^ 2 + C190 ^ 2 + C195 ^ 2 + C200 ^ 2 + C205 ^ 2 + C210 ^ 2 + C215 ^ 2 + C220 ^ 2 + C225 ^ 2 + C230 ^ 2 + C235 ^ 2 + C240 ^ 2 + C245 ^ 2 + C250 ^ 2 + C255 ^ 2 + C260 ^ 2 + C265 ^ 2 + C270 ^ 2 + C275 ^ 2 + C280 ^ 2 + C285 ^ 2 + C290 ^ 2 + C295 ^ 2 + C300 ^ 2 + C305 ^ 2 + C310 ^ 2 + C315 ^ 2 + C320 ^ 2 + C325 ^ 2 + C330 ^ 2 + C335 ^ 2 + C340 ^ 2 + C345 ^ 2 + C350 ^ 2 + C355 ^ 2 + C360 ^ 2 + C365 ^ 2 + C370 ^ 2 + C375 ^ 2 + C380 ^ 2 + C385 ^ 2 + C390 ^ 2 + C395 ^ 2 + C400 ^ 2 + C405 ^ 2 + C410 ^ 2 + C415 ^ 2 + C420 ^ 2 + C425 ^ 2 + C430 ^ 2 + C435 ^ 2 + C440 ^ 2 + C445 ^ 2 + C450 ^ 2 + C455 ^ 2 + C460 ^ 2 + C465 ^ 2 + C470 ^ 2 + C475 ^ 2 + C480 ^ 2 + C485 ^ 2 + C490 ^ 2 + C495 ^ 2 - 100 * ((C + C5 + C10 + C15 + C20 + C25 + C30 + C35 + C40 + C45 + C50 + C55 + C60 + C65 + C70 + C75 + C80 + C85 + C90 + C95 + C100 + C105 + C110 + C115 + C120 + C125 + C130 + C135 + C140 + C145 + C150 + C155 + C160 + C165 + C170 + C175 + C180 + C185 + C190 + C195 + C200 + C205 + C210 + C215 + C220 + C225 + C230 + C235 + C240 + C245 + C250 + C255 + C260 + C265 + C270 + C275 + C280 + C285 + C290 + C295 + C300 + C305 + C310 + C315 + C320 + C325 + C330 + C335 + C340 + C345 + C350 + C355 + C360 + C365 + C370 + C375 + C380 + C385 + C390 + C395 + C400 + C405 + C410 + C415 + C420 + C425 + C430 + C435 + C440 + C445 + C450 + C455 + C460 + C465 + C470 + C475 + C480 + C485 + C490 + C495) / 100) ^ 2) / 100) AND C < ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420 + C441 + C462 + C483 + C504 + C525 + C546 + C567 + C588 + C609 + C630 + C651 + C672 + C693 + C714 + C735 + C756 + C777 + C798 + C819 + C840 + C861 + C882 + C903 + C924 + C945 + C966 + C987 + C1008 + C1029 + C1050 + C1071 + C1092 + C1113 + C1134 + C1155 + C1176 + C1197 + C1218 + C1239 + C1260 + C1281 + C1302 + C1323 + C1344 + C1365 + C1386 + C1407 + C1428 + C1449 + C1470 + C1491 + C1512 + C1533 + C1554 + C1575 + C1596 + C1617 + C1638 + C1659 + C1680 + C1701 + C1722 + C1743 + C1764 + C1785 + C1806 + C1827 + C1848 + C1869 + C1890 + C1911 + C1932 + C1953 + C1974 + C1995 + C2016 + C2037 + C2058 + C2079) / 100) + 49.5 * (49.5 * C + 48.5 * C21 + 47.5 * C42 + 46.5 * C63 + 45.5 * C84 + 44.5 * C105 + 43.5 * C126 + 42.5 * C147 + 41.5 * C168 + 40.5 * C189 + 39.5 * C210 + 38.5 * C231 + 37.5 * C252 + 36.5 * C273 + 35.5 * C294 + 34.5 * C315 + 33.5 * C336 + 32.5 * C357 + 31.5 * C378 + 30.5 * C399 + 29.5 * C420 + 28.5 * C441 + 27.5 * C462 + 26.5 * C483 + 25.5 * C504 + 24.5 * C525 + 23.5 * C546 + 22.5 * C567 + 21.5 * C588 + 20.5 * C609 + 19.5 * C630 + 18.5 * C651 + 17.5 * C672 + 16.5 * C693 + 15.5 * C714 + 14.5 * C735 + 13.5 * C756 + 12.5 * C777 + 11.5 * C798 + 10.5 * C819 + 9.5 * C840 + 8.5 * C861 + 7.5 * C882 + 6.5 * C903 + 5.5 * C924 + 4.5 * C945 + 3.5 * C966 + 2.5 * C987 + 1.5 * C1008 + 0.5 * C1029 - 0.5 * C1050 - 1.5 * C1071 - 2.5 * C1092 - 3.5 * C1113 - 4.5 * C1134 - 5.5 * C1155 - 6.5 * C1176 - 7.5 * C1197 - 8.5 * C1218 - 9.5 * C1239 - 10.5 * C1260 - 11.5 * C1281 - 12.5 * C1302 - 13.5 * C1323 - 14.5 * C1344 - 15.5 * C1365 - 16.5 * C1386 - 17.5 * C1407 - 18.5 * C1428 - 19.5 * C1449 - 20.5 * C1470 - 21.5 * C1491 - 22.5 * C1512 - 23.5 * C1533 - 24.5 * C1554 - 25.5 * C1575 - 26.5 * C1596 - 27.5 * C1617 - 28.5 * C1638 - 29.5 * C1659 - 30.5 * C1680 - 31.5 * C1701 - 32.5 * C1722 - 33.5 * C1743 - 34.5 * C1764 - 35.5 * C1785 - 36.5 * C1806 - 37.5 * C1827 - 38.5 * C1848 - 39.5 * C1869 - 40.5 * C1890 - 41.5 * C1911 - 42.5 * C1932 - 43.5 * C1953 - 44.5 * C1974 - 45.5 * C1995 - 46.5 * C2016 - 47.5 * C2037 - 48.5 * C2058 - 49.5 * C2079) / 83325 - 2 * SQR(ABS(C ^ 2 + C21 ^ 2 + C42 ^ 2 + C63 ^ 2 + C84 ^ 2 + C105 ^ 2 + C126 ^ 2 + C147 ^ 2 + C168 ^ 2 + C189 ^ 2 + C210 ^ 2 + C231 ^ 2 + C252 ^ 2 + C273 ^ 2 + C294 ^ 2 + C315 ^ 2 + C336 ^ 2 + C357 ^ 2 + C378 ^ 2 + C399 ^ 2 + C420 ^ 2 + C441 ^ 2 + C462 ^ 2 + C483 ^ 2 + C504 ^ 2 + C525 ^ 2 + C546 ^ 2 + C567 ^ 2 + C588 ^ 2 + C609 ^ 2 + C630 ^ 2 + C651 ^ 2 + C672 ^ 2 + C693 ^ 2 + C714 ^ 2 + C735 ^ 2 + C756 ^ 2 + C777 ^ 2 + C798 ^ 2 + C819 ^ 2 + C840 ^ 2 + C861 ^ 2 + C882 ^ 2 + C903 ^ 2 + C924 ^ 2 + C945 ^ 2 + C966 ^ 2 + C987 ^ 2 + C1008 ^ 2 + C1029 ^ 2 + C1050 ^ 2 + C1071 ^ 2 + C1092 ^ 2 + C1113 ^ 2 + C1134 ^ 2 + C1155 ^ 2 + C1176 ^ 2 + C1197 ^ 2 + C1218 ^ 2 + C1239 ^ 2 + C1260 ^ 2 + C1281 ^ 2 + C1302 ^ 2 + C1323 ^ 2 + C1344 ^ 2 + C1365 ^ 2 + C1386 ^ 2 + C1407 ^ 2 + C1428 ^ 2 + C1449 ^ 2 + C1470 ^ 2 + C1491 ^ 2 + C1512 ^ 2 + C1533 ^ 2 + C1554 ^ 2 + C1575 ^ 2 + C1596 ^ 2 + C1617 ^ 2 + C1638 ^ 2 + C1659 ^ 2 + C1680 ^ 2 + C1701 ^ 2 + C1722 ^ 2 + C1743 ^ 2 + C1764 ^ 2 + C1785 ^ 2 + C1806 ^ 2 + C1827 ^ 2 + C1848 ^ 2 + C1869 ^ 2 + C1890 ^ 2 + C1911 ^ 2 + C1932 ^ 2 + C1953 ^ 2 + C1974 ^ 2 + C1995 ^ 2 + C2016 ^ 2 + C2037 ^ 2 + C2058 ^ 2 + C2079 ^ 2 - 100 * ((C + C21 + C42 + C63 + C84 + C105 + C126 + C147 + C168 + C189 + C210 + C231 + C252 + C273 + C294 + C315 + C336 + C357 + C378 + C399 + C420 + C441 + C462 + C483 + C504 + C525 + C546 + C567 + C588 + C609 + C630 + C651 + C672 + C693 + C714 + C735 + C756 + C777 + C798 + C819 + C840 + C861 + C882 + C903 + C924 + C945 + C966 + C987 + C1008 + C1029 + C1050 + C1071 + C1092 + C1113 + C1134 + C1155 + C1176 + C1197 + C1218 + C1239 + C1260 + C1281 + C1302 + C1323 + C1344 + C1365 + C1386 + C1407 + C1428 + C1449 + C1470 + C1491 + C1512 + C1533 + C1554 + C1575 + C1596 + C1617 + C1638 + C1659 + C1680 + C1701 + C1722 + C1743 + C1764 + C1785 + C1806 + C1827 + C1848 + C1869 + C1890 + C1911 + C1932 + C1953 + C1974 + C1995 + C2016 + C2037 + C2058 + C2079) / 100) ^ 2) / 100)



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