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 channel calculations Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Thom
Posted : Wednesday, January 26, 2005 11:46:11 PM
Registered User
Joined: 1/9/2005
Posts: 1
Today (1/26/05) I placed a 60 day linear regression line with a channel width of 10 on SNPS. The Linear regression line value for today is 18.30, the upper channel is about 18.61 and the lower channel is about 17.99.

When I calculate the standard deviation of the last 60 closing prices, using EXCEL, I get .80 (0.79973). I would expect TC2000 to plot the upper channel line value to be 19.10 and the lower channel value line to be 17.50.

Can you please explain the difference please.

If TC2000 is calculating the standard deviation on something other than the closing prices what is it using?

Thank you in advance.
Doug_H
Posted : Thursday, January 27, 2005 7:32:32 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
Thom:

I'll check into this and someone will post an answer back here for you.

- Doug
Teaching Online!
Tanstaafl
Posted : Friday, January 28, 2005 10:57:45 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
I've asked about this before. It appears that TC does not use a true Std.Dev calc, even though they use those terms to describe it. It also does not appear to be a Std.Error calc. I would certainly appreciate it if W would tell us specifically what the formula is ... presuming it is not proprietary, of course ... or (better) that it should be changed to in fact *be* a std dev calc.

Jim Dean


Bruce_L
Posted : Sunday, March 20, 2005 1:22:38 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
These formulas should match the charts:

Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995

Upper Band of Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995 +10*(ABS(C58 -AVGC2.58) +ABS(C57 -AVGC3.57) +ABS(C56 -AVGC4.56) +ABS(C55 -AVGC5.55) +ABS(C54 -AVGC6.54) +ABS(C53 -AVGC7.53) +ABS(C52 -AVGC8.52) +ABS(C51 -AVGC9.51) +ABS(C50 -AVGC10.50) +ABS(C49 -AVGC11.49) +ABS(C48 -AVGC12.48) +ABS(C47 -AVGC13.47) +ABS(C46 -AVGC14.46) +ABS(C45 -AVGC15.45) +ABS(C44 -AVGC16.44) +ABS(C43 -AVGC17.43) +ABS(C42 -AVGC18.42) +ABS(C41 -AVGC19.41) +ABS(C40 -AVGC20.40) +ABS(C39 -AVGC21.39) +ABS(C38 -AVGC22.38) +ABS(C37 -AVGC23.37) +ABS(C36 -AVGC24.36) +ABS(C35 -AVGC25.35) +ABS(C34 -AVGC26.34) +ABS(C33 -AVGC27.33) +ABS(C32 -AVGC28.32) +ABS(C31 -AVGC29.31) +ABS(C30 -AVGC30.30) +ABS(C29 -AVGC31.29) +ABS(C28 -AVGC32.28) +ABS(C27 -AVGC33.27) +ABS(C26 -AVGC34.26) +ABS(C25 -AVGC35.25) +ABS(C24 -AVGC36.24) +ABS(C23 -AVGC37.23) +ABS(C22 -AVGC38.22) +ABS(C21 -AVGC39.21) +ABS(C20 -AVGC40.20) +ABS(C19 -AVGC41.19) +ABS(C18 -AVGC42.18) +ABS(C17 -AVGC43.17) +ABS(C16 -AVGC44.16) +ABS(C15 -AVGC45.15) +ABS(C14 -AVGC46.14) +ABS(C13 -AVGC47.13) +ABS(C12 -AVGC48.12) +ABS(C11 -AVGC49.11) +ABS(C10 -AVGC50.10) +ABS(C9 -AVGC51.9) +ABS(C8 -AVGC52.8) +ABS(C7 -AVGC53.7) +ABS(C6 -AVGC54.6) +ABS(C5 -AVGC55.5) +ABS(C4 -AVGC56.4) +ABS(C3 -AVGC57.3) +ABS(C2 -AVGC58.2) +ABS(C1 -AVGC59.1) +ABS(C -AVGC60))/1200

Lower Band of Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995 -10*(ABS(C58 -AVGC2.58) +ABS(C57 -AVGC3.57) +ABS(C56 -AVGC4.56) +ABS(C55 -AVGC5.55) +ABS(C54 -AVGC6.54) +ABS(C53 -AVGC7.53) +ABS(C52 -AVGC8.52) +ABS(C51 -AVGC9.51) +ABS(C50 -AVGC10.50) +ABS(C49 -AVGC11.49) +ABS(C48 -AVGC12.48) +ABS(C47 -AVGC13.47) +ABS(C46 -AVGC14.46) +ABS(C45 -AVGC15.45) +ABS(C44 -AVGC16.44) +ABS(C43 -AVGC17.43) +ABS(C42 -AVGC18.42) +ABS(C41 -AVGC19.41) +ABS(C40 -AVGC20.40) +ABS(C39 -AVGC21.39) +ABS(C38 -AVGC22.38) +ABS(C37 -AVGC23.37) +ABS(C36 -AVGC24.36) +ABS(C35 -AVGC25.35) +ABS(C34 -AVGC26.34) +ABS(C33 -AVGC27.33) +ABS(C32 -AVGC28.32) +ABS(C31 -AVGC29.31) +ABS(C30 -AVGC30.30) +ABS(C29 -AVGC31.29) +ABS(C28 -AVGC32.28) +ABS(C27 -AVGC33.27) +ABS(C26 -AVGC34.26) +ABS(C25 -AVGC35.25) +ABS(C24 -AVGC36.24) +ABS(C23 -AVGC37.23) +ABS(C22 -AVGC38.22) +ABS(C21 -AVGC39.21) +ABS(C20 -AVGC40.20) +ABS(C19 -AVGC41.19) +ABS(C18 -AVGC42.18) +ABS(C17 -AVGC43.17) +ABS(C16 -AVGC44.16) +ABS(C15 -AVGC45.15) +ABS(C14 -AVGC46.14) +ABS(C13 -AVGC47.13) +ABS(C12 -AVGC48.12) +ABS(C11 -AVGC49.11) +ABS(C10 -AVGC50.10) +ABS(C9 -AVGC51.9) +ABS(C8 -AVGC52.8) +ABS(C7 -AVGC53.7) +ABS(C6 -AVGC54.6) +ABS(C5 -AVGC55.5) +ABS(C4 -AVGC56.4) +ABS(C3 -AVGC57.3) +ABS(C2 -AVGC58.2) +ABS(C1 -AVGC59.1) +ABS(C -AVGC60))/1200

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Tanstaafl
Posted : Sunday, March 20, 2005 2:31:57 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
For completeness, here is a link to the thread which gives a general formula for modelling the LinReg line (point, slope, extension) in a PCF:

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis

bustermu
Posted : Sunday, March 20, 2005 11:49:11 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Bruce,

Now we know. Thanks a lot.

Please note that Linear Regression (20,0,20) has exactly the same channel width as Moving Linear Regression (19,0,0,20). Why one more bar is used to calculate dispersion for Moving Linear Regression than to calculate dispersion for Linear Regression I have no idea. Does anyone else?

Please note that the measure of dispersion used has nothing to do with how well the linear regression line fits the data. Why not? A linear regression line fits a straight line with zero error, but the calculated dispersion increases with the magnitude of the slope of the line.

Please note that if the dispersion is plotted for an impulse of data, the calculated dispersion is zero until the LR line includes the pulse. The dispersion, and, consequently, the channel width, increases until the pulse leaves the LR line (or leaves the LR line plus one bar in the case of Moving Linear Regression) and then drops to zero again. This is certainly an undesirable trait. Whatever measure of dispersion is used, it should not increase as the pulse moves to the left of the center of the LR line.

If you wish to observe the channel for an impulse of data, plot

(-1)*(V=x)

as a Custom Indicator, where x is some unique volume value toward the left of your screen. Check Center Zero Line. Then place a Moving Linear Regression with channel on the indicator.

Thanks,
Jim Murphy
Tanstaafl
Posted : Monday, March 21, 2005 7:56:48 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Thanks, JimM, for the clarification regarding the terminology here.
I figured this Channel math had a name - "Dispersion" sounds good :~)
Certainly it is NOT the "Standard Deviation" that Help terms it :~(

To clarify Bruce's formula, as I understand it thus far:

Upper Channel = LinReg + Offset
Lower Channel = LinReg - Offset
where:
LinReg formula is defined in the other thread (see above)
Offset = Width/10 * SumDiffs / LRpds / 2
where:
Width and LRpds are TC input values
SumDiffs = sum of (LRpds-1) terms, each being: Abs(Cm-AvgCn.m)
where:
m = 0 to LRpds-2
n = LRpds - m

Example Offset for LRpds = 4, Width=10, normal channel:
10/10 * (ABS(C2-AVGC2.2)+ABS(C1-AVGC3.1)+ABS(C-AVGC4)) / 4 / 2

There is one other twist ... if the PCF is used to model the
"Moving" LinReg channel, then the Offset formula is calculated
just a little bit differently (as JimM mentioned above):

Offset for Moving LR channel: same as above, BUT ...
Offset = Width/10 * SumDiffs / n / 2
where:
SumDiffs = sum of (LRpds) terms, each being: Abs(Cm-AvgCn.m)
where:
m = 0 to LRpds-2
n = LRpds + 1

Example Offset for LRpds = 4, Width=10, Moving channel:
10/10 * (ABS(C3-AVGC2.3)+ABS(C2-AVGC3.2)+ABS(C1-AVGC4.1)+ABS(C-AVGC5)) / 5 / 2


Credit (and THANKS) to Bruce L for making these Offset formulae clear -
I am simply being a messenger here to try to generalize the solution.
For the record ... I have not as yet had time to check this for accuracy.

Jim Dean

psrkn
Posted : Monday, September 19, 2005 6:36:21 PM
Registered User
Joined: 12/1/2004
Posts: 56
Hi Bruce,

Could you please create a Linear Regression of Price (63,0,18),
Upper Band of Linear Regression of Price (63,0,18),and
Lower Band of Linear Regression of Price (63,0,18)for me?

Sorry that I have to bother you, I don't know enough to come up with the formulars by myself.

Thank you in advance.

Bruce_L
Posted : Tuesday, September 20, 2005 6:58:58 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
psrkn,
The following formulas are based on a (non-Moving) Linear Regression Period of 63 and a Width of 18.

Linear Regression of Price (63,18):

AVGC63 + 31 * (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

Upper Band of Linear Regression of Price (63,18):

AVGC63 + 31 * (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 + 18 * (ABS(C61 - AVGC2.61) + ABS(C60 - AVGC3.60) + ABS(C59 - AVGC4.59) + ABS(C58 - AVGC5.58) + ABS(C57 - AVGC6.57) + ABS(C56 - AVGC7.56) + ABS(C55 - AVGC8.55) + ABS(C54 - AVGC9.54) + ABS(C53 - AVGC10.53) + ABS(C52 - AVGC11.52) + ABS(C51 - AVGC12.51) + ABS(C50 - AVGC13.50) + ABS(C49 - AVGC14.49) + ABS(C48 - AVGC15.48) + ABS(C47 - AVGC16.47) + ABS(C46 - AVGC17.46) + ABS(C45 - AVGC18.45) + ABS(C44 - AVGC19.44) + ABS(C43 - AVGC20.43) + ABS(C42 - AVGC21.42) + ABS(C41 - AVGC22.41) + ABS(C40 - AVGC23.40) + ABS(C39 - AVGC24.39) + ABS(C38 - AVGC25.38) + ABS(C37 - AVGC26.37) + ABS(C36 - AVGC27.36) + ABS(C35 - AVGC28.35) + ABS(C34 - AVGC29.34) + ABS(C33 - AVGC30.33) + ABS(C32 - AVGC31.32) + ABS(C31 - AVGC32.31) + ABS(C30 - AVGC33.30) + ABS(C29 - AVGC34.29) + ABS(C28 - AVGC35.28) + ABS(C27 - AVGC36.27) + ABS(C26 - AVGC37.26) + ABS(C25 - AVGC38.25) + ABS(C24 - AVGC39.24) + ABS(C23 - AVGC40.23) + ABS(C22 - AVGC41.22) + ABS(C21 - AVGC42.21) + ABS(C20 - AVGC43.20) + ABS(C19 - AVGC44.19) + ABS(C18 - AVGC45.18) + ABS(C17 - AVGC46.17) + ABS(C16 - AVGC47.16) + ABS(C15 - AVGC48.15) + ABS(C14 - AVGC49.14) + ABS(C13 - AVGC50.13) + ABS(C12 - AVGC51.12) + ABS(C11 - AVGC52.11) + ABS(C10 - AVGC53.10) + ABS(C9 - AVGC54.9) + ABS(C8 - AVGC55.8) + ABS(C7 - AVGC56.7) + ABS(C6 - AVGC57.6) + ABS(C5 - AVGC58.5) + ABS(C4 - AVGC59.4) + ABS(C3 - AVGC60.3) + ABS(C2 - AVGC61.2) + ABS(C1 - AVGC62.1) + ABS(C - AVGC63)) / 1260

Lower Band of Linear Regression of Price (63,18):

AVGC63 + 31 * (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 - 18 * (ABS(C61 - AVGC2.61) + ABS(C60 - AVGC3.60) + ABS(C59 - AVGC4.59) + ABS(C58 - AVGC5.58) + ABS(C57 - AVGC6.57) + ABS(C56 - AVGC7.56) + ABS(C55 - AVGC8.55) + ABS(C54 - AVGC9.54) + ABS(C53 - AVGC10.53) + ABS(C52 - AVGC11.52) + ABS(C51 - AVGC12.51) + ABS(C50 - AVGC13.50) + ABS(C49 - AVGC14.49) + ABS(C48 - AVGC15.48) + ABS(C47 - AVGC16.47) + ABS(C46 - AVGC17.46) + ABS(C45 - AVGC18.45) + ABS(C44 - AVGC19.44) + ABS(C43 - AVGC20.43) + ABS(C42 - AVGC21.42) + ABS(C41 - AVGC22.41) + ABS(C40 - AVGC23.40) + ABS(C39 - AVGC24.39) + ABS(C38 - AVGC25.38) + ABS(C37 - AVGC26.37) + ABS(C36 - AVGC27.36) + ABS(C35 - AVGC28.35) + ABS(C34 - AVGC29.34) + ABS(C33 - AVGC30.33) + ABS(C32 - AVGC31.32) + ABS(C31 - AVGC32.31) + ABS(C30 - AVGC33.30) + ABS(C29 - AVGC34.29) + ABS(C28 - AVGC35.28) + ABS(C27 - AVGC36.27) + ABS(C26 - AVGC37.26) + ABS(C25 - AVGC38.25) + ABS(C24 - AVGC39.24) + ABS(C23 - AVGC40.23) + ABS(C22 - AVGC41.22) + ABS(C21 - AVGC42.21) + ABS(C20 - AVGC43.20) + ABS(C19 - AVGC44.19) + ABS(C18 - AVGC45.18) + ABS(C17 - AVGC46.17) + ABS(C16 - AVGC47.16) + ABS(C15 - AVGC48.15) + ABS(C14 - AVGC49.14) + ABS(C13 - AVGC50.13) + ABS(C12 - AVGC51.12) + ABS(C11 - AVGC52.11) + ABS(C10 - AVGC53.10) + ABS(C9 - AVGC54.9) + ABS(C8 - AVGC55.8) + ABS(C7 - AVGC56.7) + ABS(C6 - AVGC57.6) + ABS(C5 - AVGC58.5) + ABS(C4 - AVGC59.4) + ABS(C3 - AVGC60.3) + ABS(C2 - AVGC61.2) + ABS(C1 - AVGC62.1) + ABS(C - AVGC63)) / 1260

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
BobSoBayEnt
Posted : Tuesday, December 6, 2005 3:20:54 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 28
Bruce -

Where does the denominator come from (the 17995)?

Also, I want only the center Linear Regression line, not the deviation lines so I omitted everything past 17995 in the two lower PCFs. Is that the correct way to get only the main LR line? Thanks

BobSoBayEnt

QUOTE (Bruce_L)
These formulas should match the charts:

Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995

Upper Band of Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995 +10*(ABS(C58 -AVGC2.58) +ABS(C57 -AVGC3.57) +ABS(C56 -AVGC4.56) +ABS(C55 -AVGC5.55) +ABS(C54 -AVGC6.54) +ABS(C53 -AVGC7.53) +ABS(C52 -AVGC8.52) +ABS(C51 -AVGC9.51) +ABS(C50 -AVGC10.50) +ABS(C49 -AVGC11.49) +ABS(C48 -AVGC12.48) +ABS(C47 -AVGC13.47) +ABS(C46 -AVGC14.46) +ABS(C45 -AVGC15.45) +ABS(C44 -AVGC16.44) +ABS(C43 -AVGC17.43) +ABS(C42 -AVGC18.42) +ABS(C41 -AVGC19.41) +ABS(C40 -AVGC20.40) +ABS(C39 -AVGC21.39) +ABS(C38 -AVGC22.38) +ABS(C37 -AVGC23.37) +ABS(C36 -AVGC24.36) +ABS(C35 -AVGC25.35) +ABS(C34 -AVGC26.34) +ABS(C33 -AVGC27.33) +ABS(C32 -AVGC28.32) +ABS(C31 -AVGC29.31) +ABS(C30 -AVGC30.30) +ABS(C29 -AVGC31.29) +ABS(C28 -AVGC32.28) +ABS(C27 -AVGC33.27) +ABS(C26 -AVGC34.26) +ABS(C25 -AVGC35.25) +ABS(C24 -AVGC36.24) +ABS(C23 -AVGC37.23) +ABS(C22 -AVGC38.22) +ABS(C21 -AVGC39.21) +ABS(C20 -AVGC40.20) +ABS(C19 -AVGC41.19) +ABS(C18 -AVGC42.18) +ABS(C17 -AVGC43.17) +ABS(C16 -AVGC44.16) +ABS(C15 -AVGC45.15) +ABS(C14 -AVGC46.14) +ABS(C13 -AVGC47.13) +ABS(C12 -AVGC48.12) +ABS(C11 -AVGC49.11) +ABS(C10 -AVGC50.10) +ABS(C9 -AVGC51.9) +ABS(C8 -AVGC52.8) +ABS(C7 -AVGC53.7) +ABS(C6 -AVGC54.6) +ABS(C5 -AVGC55.5) +ABS(C4 -AVGC56.4) +ABS(C3 -AVGC57.3) +ABS(C2 -AVGC58.2) +ABS(C1 -AVGC59.1) +ABS(C -AVGC60))/1200

Lower Band of Linear Regression of Price (60,0,10):
AVGC60 +29.5*(29.5*C +28.5*C1 +27.5*C2 +26.5*C3 +25.5*C4 +24.5*C5 +23.5*C6 +22.5*C7 +21.5*C8 +20.5*C9 +19.5*C10 +18.5*C11 +17.5*C12 +16.5*C13 +15.5*C14 +14.5*C15 +13.5*C16 +12.5*C17 +11.5*C18 +10.5*C19 +9.5*C20 +8.5*C21 +7.5*C22 +6.5*C23 +5.5*C24 +4.5*C25 +3.5*C26 +2.5*C27 +1.5*C28 +0.5*C29 -0.5*C30 -1.5*C31 -2.5*C32 -3.5*C33 -4.5*C34 -5.5*C35 -6.5*C36 -7.5*C37 -8.5*C38 -9.5*C39 -10.5*C40 -11.5*C41 -12.5*C42 -13.5*C43 -14.5*C44 -15.5*C45 -16.5*C46 -17.5*C47 -18.5*C48 -19.5*C49 -20.5*C50 -21.5*C51 -22.5*C52 -23.5*C53 -24.5*C54 -25.5*C55 -26.5*C56 -27.5*C57 -28.5*C58 -29.5*C59)/17995 -10*(ABS(C58 -AVGC2.58) +ABS(C57 -AVGC3.57) +ABS(C56 -AVGC4.56) +ABS(C55 -AVGC5.55) +ABS(C54 -AVGC6.54) +ABS(C53 -AVGC7.53) +ABS(C52 -AVGC8.52) +ABS(C51 -AVGC9.51) +ABS(C50 -AVGC10.50) +ABS(C49 -AVGC11.49) +ABS(C48 -AVGC12.48) +ABS(C47 -AVGC13.47) +ABS(C46 -AVGC14.46) +ABS(C45 -AVGC15.45) +ABS(C44 -AVGC16.44) +ABS(C43 -AVGC17.43) +ABS(C42 -AVGC18.42) +ABS(C41 -AVGC19.41) +ABS(C40 -AVGC20.40) +ABS(C39 -AVGC21.39) +ABS(C38 -AVGC22.38) +ABS(C37 -AVGC23.37) +ABS(C36 -AVGC24.36) +ABS(C35 -AVGC25.35) +ABS(C34 -AVGC26.34) +ABS(C33 -AVGC27.33) +ABS(C32 -AVGC28.32) +ABS(C31 -AVGC29.31) +ABS(C30 -AVGC30.30) +ABS(C29 -AVGC31.29) +ABS(C28 -AVGC32.28) +ABS(C27 -AVGC33.27) +ABS(C26 -AVGC34.26) +ABS(C25 -AVGC35.25) +ABS(C24 -AVGC36.24) +ABS(C23 -AVGC37.23) +ABS(C22 -AVGC38.22) +ABS(C21 -AVGC39.21) +ABS(C20 -AVGC40.20) +ABS(C19 -AVGC41.19) +ABS(C18 -AVGC42.18) +ABS(C17 -AVGC43.17) +ABS(C16 -AVGC44.16) +ABS(C15 -AVGC45.15) +ABS(C14 -AVGC46.14) +ABS(C13 -AVGC47.13) +ABS(C12 -AVGC48.12) +ABS(C11 -AVGC49.11) +ABS(C10 -AVGC50.10) +ABS(C9 -AVGC51.9) +ABS(C8 -AVGC52.8) +ABS(C7 -AVGC53.7) +ABS(C6 -AVGC54.6) +ABS(C5 -AVGC55.5) +ABS(C4 -AVGC56.4) +ABS(C3 -AVGC57.3) +ABS(C2 -AVGC58.2) +ABS(C1 -AVGC59.1) +ABS(C -AVGC60))/1200
Bruce_L
Posted : Tuesday, December 6, 2005 3:31:00 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
BobSoBayEnt,
If you only want the Linear Regression Line, you only need the first Personal Criteria Formula. The 177995 at the end is the sum of the squares of the coefficents.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
BobSoBayEnt
Posted : Tuesday, December 6, 2005 6:05:42 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 28
QUOTE (Bruce_L)
BobSoBayEnt,
If you only want the Linear Regression Line, you only need the first Personal Criteria Formula. The 177995 at the end is the sum of the squares of the coefficents.


Thanks. I wasn't sure what a coefficient was, but I guessed and was right. I need to take a math class to renew my 35 year old math skills.
bigjim499
Posted : Sunday, January 22, 2006 9:26:18 PM
Registered User
Joined: 11/30/2005
Posts: 2
hello,
Can someone help me with some code please?


valuedesired=(Linregtoday-Linreg200daysago)/Linreg200daysago



Percent change value value of a straight(Not rolling)Linear regression line


Thanks much, Jim
Tanstaafl
Posted : Sunday, January 22, 2006 11:27:48 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Hi, Jim:

You need to specify the time window for the Linear Regression. That is, a 10-day LinReg uses the data from ten bars to determine the best-fit line. A 20-day uses 20 bars, and so on.

Also, you need to indicate whether you want the VALUE of the LinReg line as of a given day, or the SLOPE of the line as of that day.

Jim Dean


Winnie
Posted : Monday, January 23, 2006 12:11:27 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

I’m now trying to understand the math behind the Linear Regression Sort Method, can you provide the PCF Formulas for each Linear Regression Sort Method. Then give an PCF example of each, say for a Linear Regression (60,0,0)
1. Channel Sort
2. Visual Sort
3. % Slope

Thanks
Winnie
Bruce_L
Posted : Monday, January 23, 2006 2:01:36 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
Division by Zero issues make a Channel Sort with Linear Regression Settings of (60,0,0) mathematically impossible, so I'm going to provide Personal Criteria Formulas based on settings of (60,0,10) instead (the Width setting should not affect either the Visual or Percent Slope Sorts).

Daily Linear Regression (60,0,10) Channel Sort:
100 * (C - AVGC60 - 29.5 * (29.5 * C + 28.5 * C1 + 27.5 * C2 + 26.5 * C3 + 25.5 * C4 + 24.5 * C5 + 23.5 * C6 + 22.5 * C7 + 21.5 * C8 + 20.5 * C9 + 19.5 * C10 + 18.5 * C11 + 17.5 * C12 + 16.5 * C13 + 15.5 * C14 + 14.5 * C15 + 13.5 * C16 + 12.5 * C17 + 11.5 * C18 + 10.5 * C19 + 9.5 * C20 + 8.5 * C21 + 7.5 * C22 + 6.5 * C23 + 5.5 * C24 + 4.5 * C25 + 3.5 * C26 + 2.5 * C27 + 1.5 * C28 + 0.5 * C29 - 0.5 * C30 - 1.5 * C31 - 2.5 * C32 - 3.5 * C33 - 4.5 * C34 - 5.5 * C35 - 6.5 * C36 - 7.5 * C37 - 8.5 * C38 - 9.5 * C39 - 10.5 * C40 - 11.5 * C41 - 12.5 * C42 - 13.5 * C43 - 14.5 * C44 - 15.5 * C45 - 16.5 * C46 - 17.5 * C47 - 18.5 * C48 - 19.5 * C49 - 20.5 * C50 - 21.5 * C51 - 22.5 * C52 - 23.5 * C53 - 24.5 * C54 - 25.5 * C55 - 26.5 * C56 - 27.5 * C57 - 28.5 * C58 - 29.5 * C59) / 17995) / (10 * (ABS(C58 - AVGC2.58) + ABS(C57 - AVGC3.57) + ABS(C56 - AVGC4.56) + ABS(C55 - AVGC5.55) + ABS(C54 - AVGC6.54) + ABS(C53 - AVGC7.53) + ABS(C52 - AVGC8.52) + ABS(C51 - AVGC9.51) + ABS(C50 - AVGC10.50) + ABS(C49 - AVGC11.49) + ABS(C48 - AVGC12.48) + ABS(C47 - AVGC13.47) + ABS(C46 - AVGC14.46) + ABS(C45 - AVGC15.45) + ABS(C44 - AVGC16.44) + ABS(C43 - AVGC17.43) + ABS(C42 - AVGC18.42) + ABS(C41 - AVGC19.41) + ABS(C40 - AVGC20.40) + ABS(C39 - AVGC21.39) + ABS(C38 - AVGC22.38) + ABS(C37 - AVGC23.37) + ABS(C36 - AVGC24.36) + ABS(C35 - AVGC25.35) + ABS(C34 - AVGC26.34) + ABS(C33 - AVGC27.33) + ABS(C32 - AVGC28.32) + ABS(C31 - AVGC29.31) + ABS(C30 - AVGC30.30) + ABS(C29 - AVGC31.29) + ABS(C28 - AVGC32.28) + ABS(C27 - AVGC33.27) + ABS(C26 - AVGC34.26) + ABS(C25 - AVGC35.25) + ABS(C24 - AVGC36.24) + ABS(C23 - AVGC37.23) + ABS(C22 - AVGC38.22) + ABS(C21 - AVGC39.21) + ABS(C20 - AVGC40.20) + ABS(C19 - AVGC41.19) + ABS(C18 - AVGC42.18) + ABS(C17 - AVGC43.17) + ABS(C16 - AVGC44.16) + ABS(C15 - AVGC45.15) + ABS(C14 - AVGC46.14) + ABS(C13 - AVGC47.13) + ABS(C12 - AVGC48.12) + ABS(C11 - AVGC49.11) + ABS(C10 - AVGC50.10) + ABS(C9 - AVGC51.9) + ABS(C8 - AVGC52.8) + ABS(C7 - AVGC53.7) + ABS(C6 - AVGC54.6) + ABS(C5 - AVGC55.5) + ABS(C4 - AVGC56.4) + ABS(C3 - AVGC57.3) + ABS(C2 - AVGC58.2) + ABS(C1 - AVGC59.1) + ABS(C - AVGC60)) / 1200)

Daily Linear Regression (60,0,10) Visual Slope Sort:
100 * (29.5 * C + 28.5 * C1 + 27.5 * C2 + 26.5 * C3 + 25.5 * C4 + 24.5 * C5 + 23.5 * C6 + 22.5 * C7 + 21.5 * C8 + 20.5 * C9 + 19.5 * C10 + 18.5 * C11 + 17.5 * C12 + 16.5 * C13 + 15.5 * C14 + 14.5 * C15 + 13.5 * C16 + 12.5 * C17 + 11.5 * C18 + 10.5 * C19 + 9.5 * C20 + 8.5 * C21 + 7.5 * C22 + 6.5 * C23 + 5.5 * C24 + 4.5 * C25 + 3.5 * C26 + 2.5 * C27 + 1.5 * C28 + 0.5 * C29 - 0.5 * C30 - 1.5 * C31 - 2.5 * C32 - 3.5 * C33 - 4.5 * C34 - 5.5 * C35 - 6.5 * C36 - 7.5 * C37 - 8.5 * C38 - 9.5 * C39 - 10.5 * C40 - 11.5 * C41 - 12.5 * C42 - 13.5 * C43 - 14.5 * C44 - 15.5 * C45 - 16.5 * C46 - 17.5 * C47 - 18.5 * C48 - 19.5 * C49 - 20.5 * C50 - 21.5 * C51 - 22.5 * C52 - 23.5 * C53 - 24.5 * C54 - 25.5 * C55 - 26.5 * C56 - 27.5 * C57 - 28.5 * C58 - 29.5 * C59) / 17995 / (MAXH62 - MINL62)

Daily Linear Regression (60,0,10) Percent Slope Sort:
100 * (29.5 * C + 28.5 * C1 + 27.5 * C2 + 26.5 * C3 + 25.5 * C4 + 24.5 * C5 + 23.5 * C6 + 22.5 * C7 + 21.5 * C8 + 20.5 * C9 + 19.5 * C10 + 18.5 * C11 + 17.5 * C12 + 16.5 * C13 + 15.5 * C14 + 14.5 * C15 + 13.5 * C16 + 12.5 * C17 + 11.5 * C18 + 10.5 * C19 + 9.5 * C20 + 8.5 * C21 + 7.5 * C22 + 6.5 * C23 + 5.5 * C24 + 4.5 * C25 + 3.5 * C26 + 2.5 * C27 + 1.5 * C28 + 0.5 * C29 - 0.5 * C30 - 1.5 * C31 - 2.5 * C32 - 3.5 * C33 - 4.5 * C34 - 5.5 * C35 - 6.5 * C36 - 7.5 * C37 - 8.5 * C38 - 9.5 * C39 - 10.5 * C40 - 11.5 * C41 - 12.5 * C42 - 13.5 * C43 - 14.5 * C44 - 15.5 * C45 - 16.5 * C46 - 17.5 * C47 - 18.5 * C48 - 19.5 * C49 - 20.5 * C50 - 21.5 * C51 - 22.5 * C52 - 23.5 * C53 - 24.5 * C54 - 25.5 * C55 - 26.5 * C56 - 27.5 * C57 - 28.5 * C58 - 29.5 * C59) / 17995 / ABS(AVGC60 - 30.5 * ((29.5 * C + 28.5 * C1 + 27.5 * C2 + 26.5 * C3 + 25.5 * C4 + 24.5 * C5 + 23.5 * C6 + 22.5 * C7 + 21.5 * C8 + 20.5 * C9 + 19.5 * C10 + 18.5 * C11 + 17.5 * C12 + 16.5 * C13 + 15.5 * C14 + 14.5 * C15 + 13.5 * C16 + 12.5 * C17 + 11.5 * C18 + 10.5 * C19 + 9.5 * C20 + 8.5 * C21 + 7.5 * C22 + 6.5 * C23 + 5.5 * C24 + 4.5 * C25 + 3.5 * C26 + 2.5 * C27 + 1.5 * C28 + 0.5 * C29 - 0.5 * C30 - 1.5 * C31 - 2.5 * C32 - 3.5 * C33 - 4.5 * C34 - 5.5 * C35 - 6.5 * C36 - 7.5 * C37 - 8.5 * C38 - 9.5 * C39 - 10.5 * C40 - 11.5 * C41 - 12.5 * C42 - 13.5 * C43 - 14.5 * C44 - 15.5 * C45 - 16.5 * C46 - 17.5 * C47 - 18.5 * C48 - 19.5 * C49 - 20.5 * C50 - 21.5 * C51 - 22.5 * C52 - 23.5 * C53 - 24.5 * C54 - 25.5 * C55 - 26.5 * C56 - 27.5 * C57 - 28.5 * C58 - 29.5 * C59) / 17995))

I haven't done exhaustive testing, but the Zoom on the charts may need to display more bars than the Period of the Linear Regression for the Slope Sort PCFs to be good approximations.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, January 23, 2006 4:38:57 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

Thanks for your reply. You helped me greatly with creating the PCF formulas for Prices above and below LR CW, those I’m very comfortable with, but I still need some help with the LR Slope Sort, please bear with me.

The nomenclature for a Linear Regression is written ( 60,0,10 ) ( Period, Extension, Channel Width )
The first number is the Linear Regression Period
The second number is the Extension
The third number is the Channel Width

Can a Linear Regression 60 with 0 Channel Width be written ( 60,0,0 ) ? if So, as noted in your post, the Channel Width setting does not affect either the Visual Sort or Percent Slope Sort, and therefore I presume the LR ( 60,0,0 ) has the same sort values as the LR ( 60,0,10 ), except for the channel?

In your Friday, January 20, 2006 5:24:31 PM post, it contains the formula for a 60-Period Linear Regression Slope, linear regression. Can you explain the difference between the one on Friday and the one today.


I’ll take stab at the PCF formulas, please make corrections:
LR = Linear Regression
CW = Channel Width
n = Channel Width Number

Channel Sort Formula: Daily Linear Regression (60,0,10).
100 * (LR / (n * (CW))

Visual Slope Sort Formula: Daily Linear Regression (60,0,10).
100 * (LR / (MAXH62 – MINL62)
Why do we not include the first part of the LR? (C - AVGC60 - 29.5
Why is the / MAXH62-MINL62 as the denominator, two periods above 60?

Percent Slope Sort Formula: Daily Linear Regression (60,0,10)
100 * (LR / ABS( AVGC-30.5((LR))))
Why do we not include the first part of the LR? (C - AVGC60 - 29.5

Hope this all makes sense to you.

Thanks
Winnie
Bruce_L
Posted : Monday, January 23, 2006 5:29:01 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
Your nomenclature matches what has been used throughout this topic. The Visual Slope and Visual Percent Slope results should be the same for LR(60,0,10) and LR(60,0,0).

The Visual Slope and Visual Percent Slope formulas are discussed in more detail in the following topic:

PCF TO RANK MUTUAL FUNDS USING LINEAR REGRESSION LINE

LR-Slope: The formula from linear regression is the slope itself expressed as the change in value of the Linear Regression per Bar.

LR-Midpoint: It's just the Simple Moving Average with the same Period as the Linear Regression.

LR-Endpoint: Multiply the LR-Slope by ((Period-1)/2) and add it to the value of the LR-Midpoint.

LR-Width: The method of calculation is the main thrust of this very topic.

LR-Channel Sort: 100 * (Price - LR-Endpoint) / (n * LR-Width)

LR-Visual Slope: 100 * LR-Slope / (MAXH(Period+2) - MINL(Period+2))

LR-Percent Slope: 100* LR-Slope / ABS(AVGC(Period)-((Period+1)/2) * LR-Slope)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, January 23, 2006 6:43:55 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Thanks Bruce - I believe this will help me grasp the material and hopefully others will also benefit from your information.

Winnie
Winnie
Posted : Tuesday, January 24, 2006 2:31:39 AM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

Just a quick note, now feel fairly confident about creating PCFs for Linear Regression Channel Sorts, Visual Slopes, and Percentage Slopes. Creating the original formula is beyond my math ability but after seeing a couple of examples and your formula, I am able to create my own Channel Sorts and Slopes, thanks.

I do have a couple of questions.

1. In your post on Tuesday, August 02, 2005 7:40:38 PM
Spotting trend changes using linear regression channel sorts
for the LR ( 50,0,15 ) Channel Sort, the formula is different from the one here today, Monday, January 23, 2006 5:29:01 PM. I created a LR ( 50,0,15 ) Channel Sort from your formula, both PCFs return the same values. I can see the differences, and have some thoughts on why but can you explain why use one over the other, I like the one today.

2. In the PCF I created today, to get the same value in the LR50 part, I had to change the + sign to a - minus sign between the AVGC50 and 24.5, is this correct?
20000 * (C - (AVGC50 + 24.5 * (24.5 * C
100 * (C - AVGC50 - 24.5 * (24.5 * C


LR (50,0,15) Channel Sort: Tuesday, August 02, 2005 7:40:38 PM
20000 * (C - (AVGC50 + 24.5 * (24.5 * C +23.5 * C1 + 22.5 * C2 + 21.5 * C3 + 20.5 * C4 + 19.5 * C5 + 18.5 * C6 + 17.5 * C7 + 16.5 * C8 + 15.5 * C9 + 14.5 * C10 + 13.5 * C11 + 12.5 * C12 + 11.5 * C13 + 10.5 * C14 + 9.5 * C15 + 8.5 * C16 + 7.5 * C17 + 6.5 * C18 + 5.5 * C19 + 4.5 * C20 + 3.5 * C21 + 2.5 * C22 + 1.5 * C23 + 0.5 * C24 - 0.5 * C25 - 1.5 * C26 -2.5 * C27 - 3.5 * C28 - 4.5 * C29 - 5.5 * C30 -6.5 * C31 - 7.5 * C32 - 8.5 * C33 - 9.5 * C34 - 10.5 * C35 - 11.5 * C36 - 12.5 * C37 - 13.5 * C38 - 14.5 * C39 -15.5 * C40 - 16.5 * C41 - 17.5 * C42 - 18.5 * C43 - 19.5 * C44 - 20.5 * C45 - 21.5 * C46 - 22.5 * C47 -23.5 * C48 - 24.5 * C49) / 10412.5)) / (ABS(C48 - AVGC2.48) + ABS(C47 - AVGC3.47) + ABS(C46 -AVGC4.46) + ABS(C45 - AVGC5.45) + ABS(C44 - AVGC6.44) + ABS(C43 - AVGC7.43) + ABS(C42 -AVGC8.42) + ABS(C41 - AVGC9.41) + ABS(C40 - AVGC10.40) + ABS(C39 - AVGC11.39) + ABS(C38 -AVGC12.38) +ABS(C37 - AVGC13.37) +ABS(C36 - AVGC14.36) + ABS(C35 - AVGC15.35) + ABS(C34 -AVGC16.34) +ABS(C33 - AVGC17.33) +ABS(C32 - AVGC18.32) +ABS(C31 - AVGC19.31) + ABS(C30 -AVGC20.30) +ABS(C29 - AVGC21.29) +ABS(C28 - AVGC22.28) +ABS(C27 - AVGC23.27) + ABS(C26 -AVGC24.26) +ABS(C25 - AVGC25.25) + ABS(C24 - AVGC26.24) +ABS(C23 - AVGC27.23) + ABS(C22 -AVGC28.22) +ABS(C21 - AVGC29.21) + ABS(C20 - AVGC30.20) +ABS(C19 - AVGC31.19) + ABS(C18 -AVGC32.18) +ABS(C17 - AVGC33.17) +ABS(C16 - AVGC34.16) +ABS(C15 - AVGC35.15) + ABS(C14 -AVGC36.14) + ABS(C13 - AVGC37.13) +ABS(C12 - AVGC38.12) +ABS(C11 - AVGC39.11) + ABS(C10 -AVGC40.10) + ABS(C9 - AVGC41.9) +ABS(C8 -AVGC42.8) +ABS(C7 -AVGC43.7) + ABS(C6 -AVGC44.6) +ABS(C5 - AVGC45.5) + ABS(C4 -AVGC46.4) +ABS(C3 -AVGC47.3) + ABS(C2 -AVGC48.2) + ABS(C1 - AVGC49.1) + ABS(C - AVGC50)) / 3

Or this way:

LR (50,0,15) Channel Sort:
Formula Today: 100 * (Price - LR-Endpoint) / (n * LR-Width)
100 * (C - AVGC50 - 24.5 * (24.5 * C +23.5 * C1 + 22.5 * C2 + 21.5 * C3 + 20.5 * C4 + 19.5 * C5 + 18.5 * C6 + 17.5 * C7 + 16.5 * C8 + 15.5 * C9 + 14.5 * C10 + 13.5 * C11 + 12.5 * C12 + 11.5 * C13 + 10.5 * C14 + 9.5 * C15 + 8.5 * C16 + 7.5 * C17 + 6.5 * C18 + 5.5 * C19 + 4.5 * C20 + 3.5 * C21 + 2.5 * C22 + 1.5 * C23 + 0.5 * C24 - 0.5 * C25 - 1.5 * C26 -2.5 * C27 - 3.5 * C28 - 4.5 * C29 - 5.5 * C30 -6.5 * C31 - 7.5 * C32 - 8.5 * C33 - 9.5 * C34 - 10.5 * C35 - 11.5 * C36 - 12.5 * C37 - 13.5 * C38 - 14.5 * C39 -15.5 * C40 - 16.5 * C41 - 17.5 * C42 - 18.5 * C43 - 19.5 * C44 - 20.5 * C45 - 21.5 * C46 - 22.5 * C47 -23.5 * C48 - 24.5 * C49) / 10412.5) / (15 * (ABS(C48 - AVGC2.48) + ABS(C47 - AVGC3.47) + ABS(C46 -AVGC4.46) + ABS(C45 - AVGC5.45) + ABS(C44 - AVGC6.44) + ABS(C43 - AVGC7.43) + ABS(C42 -AVGC8.42) + ABS(C41 - AVGC9.41) + ABS(C40 - AVGC10.40) + ABS(C39 - AVGC11.39) + ABS(C38 -AVGC12.38) +ABS(C37 - AVGC13.37) +ABS(C36 - AVGC14.36) + ABS(C35 - AVGC15.35) + ABS(C34 -AVGC16.34) +ABS(C33 - AVGC17.33) +ABS(C32 - AVGC18.32) +ABS(C31 - AVGC19.31) + ABS(C30 -AVGC20.30) +ABS(C29 - AVGC21.29) +ABS(C28 - AVGC22.28) +ABS(C27 - AVGC23.27) + ABS(C26 -AVGC24.26) +ABS(C25 - AVGC25.25) + ABS(C24 - AVGC26.24) +ABS(C23 - AVGC27.23) + ABS(C22 -AVGC28.22) +ABS(C21 - AVGC29.21) + ABS(C20 - AVGC30.20) +ABS(C19 - AVGC31.19) + ABS(C18 -AVGC32.18) +ABS(C17 - AVGC33.17) +ABS(C16 - AVGC34.16) +ABS(C15 - AVGC35.15) + ABS(C14 -AVGC36.14) + ABS(C13 - AVGC37.13) +ABS(C12 - AVGC38.12) +ABS(C11 - AVGC39.11) + ABS(C10 -AVGC40.10) + ABS(C9 - AVGC41.9) +ABS(C8 -AVGC42.8) +ABS(C7 -AVGC43.7) + ABS(C6 -AVGC44.6) +ABS(C5 - AVGC45.5) + ABS(C4 -AVGC46.4) +ABS(C3 -AVGC47.3) + ABS(C2 -AVGC48.2) + ABS(C1 - AVGC49.1) + ABS(C - AVGC50)) / 1000)


You guys do great work
And very much appreciated

Winnie
Bruce_L
Posted : Tuesday, January 24, 2006 8:01:14 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
I wrote them at different times, so slighly different things were running through my head. I just expressed how I was thinking about at the time as a Personal Criteria Formula. I personally don't have a preference. The ...AVGC50 +/- 24.5... is dependent entirely on the parentheses:

A - (B + C) = A - B - C

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Wednesday, January 25, 2006 1:00:40 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

I’m now working on three Boolean formulas or Math formulas to find stocks that are:
1. Price Between the Regression Line and the Upper Band
2. Price Between the Regression Line and the Lower Band
3. Price Between the Upper Band and Lower Band

I’ve tried to incorporate a variation of the formulas below but have not been successful.

If Price is above the Upper Band: SGN(C - (LR + CW)) = 1
If Price is at the Upper Band: SGN(C - (LR + CW)) = 0
If Price is below the Upper Band: SGN(C - (LR + CW)) = -1
If Price is above the Lower Band: SGN(C - (LR1 – CW1)) = 1
If Price is at the Lower Band: SGN(C - (LR1 – CW1)) = 0
If Price is below the Lower Band: SGN(C - (LR1 – CW1)) = -1

Can you help with the three formulas and give and example of each, make the LR a short one, say LR24 or another one that you have in your book of LR wizardry.

Thanks
Winnie
Bruce_L
Posted : Wednesday, January 25, 2006 4:20:04 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
Please try the following:

Price Vs Upper Band LR(24,0,10):

SGN(C - (AVGC24 + 11.5 * (11.5 * C + 10.5 * C1 + 9.5 * C2 + 8.5 * C3 + 7.5 * C4 + 6.5 * C5 + 5.5 * C6 + 4.5 * C7 + 3.5 * C8 + 2.5 * C9 + 1.5 * C10 + 0.5 * C11 - 0.5 * C12 - 1.5 * C13 - 2.5 * C14 - 3.5 * C15 - 4.5 * C16 - 5.5 * C17 - 6.5 * C18 - 7.5 * C19 - 8.5 * C20 - 9.5 * C21 - 10.5 * C22 - 11.5 * C23) / 1150 + 10 * (ABS(C22 - AVGC2.22) + ABS(C21 - AVGC3.21) + ABS(C20 - AVGC4.20) + ABS(C19 - AVGC5.19) + ABS(C18 - AVGC6.18) + ABS(C17 - AVGC7.17) + ABS(C16 - AVGC8.16) + ABS(C15 - AVGC9.15) + ABS(C14 - AVGC10.14) + ABS(C13 - AVGC11.13) + ABS(C12 - AVGC12.12) + ABS(C11 - AVGC13.11) + ABS(C10 - AVGC14.10) + ABS(C9 - AVGC15.9) + ABS(C8 - AVGC16.8) + ABS(C7 - AVGC17.7) + ABS(C6 - AVGC18.6) + ABS(C5 - AVGC19.5) + ABS(C4 - AVGC20.4) + ABS(C3 - AVGC21.3) + ABS(C2 - AVGC22.2) + ABS(C1 - AVGC23.1) + ABS(C - AVGC24)) / 480))

Price Vs Lower Band LR(24,0,10):

SGN(C - (AVGC24 + 11.5 * (11.5 * C + 10.5 * C1 + 9.5 * C2 + 8.5 * C3 + 7.5 * C4 + 6.5 * C5 + 5.5 * C6 + 4.5 * C7 + 3.5 * C8 + 2.5 * C9 + 1.5 * C10 + 0.5 * C11 - 0.5 * C12 - 1.5 * C13 - 2.5 * C14 - 3.5 * C15 - 4.5 * C16 - 5.5 * C17 - 6.5 * C18 - 7.5 * C19 - 8.5 * C20 - 9.5 * C21 - 10.5 * C22 - 11.5 * C23) / 1150 - 10 * (ABS(C22 - AVGC2.22) + ABS(C21 - AVGC3.21) + ABS(C20 - AVGC4.20) + ABS(C19 - AVGC5.19) + ABS(C18 - AVGC6.18) + ABS(C17 - AVGC7.17) + ABS(C16 - AVGC8.16) + ABS(C15 - AVGC9.15) + ABS(C14 - AVGC10.14) + ABS(C13 - AVGC11.13) + ABS(C12 - AVGC12.12) + ABS(C11 - AVGC13.11) + ABS(C10 - AVGC14.10) + ABS(C9 - AVGC15.9) + ABS(C8 - AVGC16.8) + ABS(C7 - AVGC17.7) + ABS(C6 - AVGC18.6) + ABS(C5 - AVGC19.5) + ABS(C4 - AVGC20.4) + ABS(C3 - AVGC21.3) + ABS(C2 - AVGC22.2) + ABS(C1 - AVGC23.1) + ABS(C - AVGC24)) / 480))

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Wednesday, January 25, 2006 7:38:37 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

Thanks for the PCF, I ran an EasyScan with the PCF, the range selector Values range from Max 1 to Min -1, I selected various settings but could not get the results for stocks within the BAND, Price between the Regression Line and Upper Band.
I also tried a different one Price Vs Upper Band for LR( 84,0,18 ) with the same results.
Then I tried another formula ABS(LR + n * CW) – (LR1 – n *CW1) for Prices between the Upper Band and Lower Band, still no go.

Need some direction and your expertise to see what I’m doing wrong.

Winnie
Bruce_L
Posted : Thursday, January 26, 2006 7:30:14 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
The following EasyScan conditions seemed to work just fine for me:

Price Vs Upper Band LR(24,0,10): Value: Min to -1
Price Vs Lower Band LR(24,0,10): Value: 1 to Max

If it isn't workng, you might want to make sure you are looking at a daily chart with matching Linear Regression settings applied to Price.

This produces results where the closing or current price is between the bands. If you need the entire bar or candle to be between the bands, replace the very first C with H in the first formula and L in the second.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Thursday, January 26, 2006 11:38:49 AM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

Good to see yours works, I’m not sure why yours works and mine not, copied and pasted the formula, must be something I’ve done, my settings are:

LR: (24,0,10) Applied to Price or Child of Price
Chart Setting: Daily, Open bar
Zoom Setting : 4
PCF: Price vs Upper Band LR (24,0,10)
EasyScan: Price vs Upper Band LR (24,0,10) with no other PCFs
Range Selector: Price Vs Upper Band LR(24,0,10): Value: Min to -1
After Today’s Update and Calculations, number of stocks in this EasyScan: 4,901

Included are stocks above and below the Upper and Lower Band, stocks between the LR and Lower Band. The numbers in the PCF look good, I even rebuilt the formula from scratch with the same results, I can’t see the error, at a convenient time please take another look at this.

Thanks
Winnie
Bruce_L
Posted : Thursday, January 26, 2006 11:58:43 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Winnie,
With the following settings I also get 4901 symbols:

Watchlist: All Stocks
Price Vs Upper Band LR(24,0,10): Value: Min to -1

I looked at a lot of symbols and none appeared to have a current price above the Upper Band (which is the only thing checked for with these settings). This would not filter out stocks below the Lower Band (you would have to add the other PCF as a condition to do that).

Please provide an example of a symbol returned by the EasyScan that does not meet the conditions so I can take a look.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Thursday, January 26, 2006 1:15:33 PM
Registered User
Joined: 10/7/2004
Posts: 1,006
Hi Bruce,

As an Archimedes moment “Eureka” you are correct, after a more thorough look, I find no stocks above the Upper Band.

I added another PCF as you noted to return only stocks that are above the LR and below the CW, see the PCF below.

My question, can these two PCFs be combined into one efficient PCF to select stock between the LR line and the CW?

I know the original PCF is a math PCF and the one below is a Boolean PCF which are difficult combine, I appreciate your comment.

PCF: Price Above LR and below the CW; Is there a better way of writing this PCF?
C>(AVGC24 + 11.5 * (11.5 * C + 10.5 * C1 + 9.5 * C2 + 8.5 * C3 + 7.5 * C4 + 6.5 * C5 + 5.5 * C6 + 4.5 * C7 + 3.5 * C8 + 2.5 * C9 + 1.5 * C10 + 0.5 * C11 - 0.5 * C12 - 1.5 * C13 - 2.5 * C14 - 3.5 * C15 - 4.5 * C16 - 5.5 * C17 - 6.5 * C18 - 7.5 * C19 - 8.5 *C20 - 9.5 * C21 - 10.5 * C22 - 11.5 * C23) / 1150) AND C< 10* (ABS(C22 - AVGC2.22) + ABS(C21 - AVGC3.21) + ABS(C20 - AVGC4.20) + ABS(C19 - AVGC5.19) + ABS(C18 - AVGC6.18) + ABS(C17 - AVGC7.17) + ABS(C16 - AVGC8.16) + ABS(C15 - AVGC9.15) + ABS(C14 - AVGC10.14) + ABS(C13 - AVGC11.13) + ABS(C12 - AVGC12.12) + ABS(C11 - AVGC13.11) + ABS(C10 - AVGC14.10) + ABS(C9 - AVGC15.9) + ABS(C8 - AVGC16.8) + ABS(C7 - AVGC17.7) + ABS(C6 - AVGC18.6) + ABS(C5 - AVGC19.5) + ABS(C4 - AVGC20.4) + ABS(C3 - AVGC21.3) + ABS(C2 - AVGC22.2) + ABS(C1 - AVGC23.1) + ABS(C - AVGC24) / 480)

Thanks
Winnie

Craig_S
Posted : Thursday, January 26, 2006 1:17:04 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
No need to combine them into one PCF... add both to the same EasyScan.

- Craig
Here to Help!
swmnkd
Posted : Saturday, September 23, 2006 11:27:12 PM
Registered User
Joined: 9/14/2006
Posts: 1
Bruce, you appear to know quite a bit about LR Channels. How would I create a PCF to model 100% LR Channels? (ie LinReg(50,0,100%) or LinReg(50,0,50%))

I noticed your formula for bands above was based on a certain number of standard deviations.

Percent channels would be calculated by assuming the distance between the channel lines to the regression line is the greatest distance that any one closing price is from the regression line.

Thanks,

Josh
Bruce_L
Posted : Sunday, September 24, 2006 10:37:59 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (swmnkd)
I noticed your formula for bands above was based on a certain number of standard deviations.

Not really. You may wish to review the following posts from this very topic for more detail on this:

bustermu - Sunday, March 20, 2005 11:49:11 PM ET
Tanstaafl - Monday, March 21, 2005 7:56:48 AM ET

QUOTE (swmnkd)
Percent channels would be calculated by assuming the distance between the channel lines to the regression line is the greatest distance that any one closing price is from the regression line.

Everything I've tried so far is too long and slow to be practical as a Personal Criteria Formula. If you are interested in doing this using SnapSheets, please start a new topic with this request and we'll explain how it can be done.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
stakano
Posted : Friday, January 26, 2007 2:19:01 PM
Registered User
Joined: 6/26/2005
Posts: 15
Hi,

I would like to add Bruce's formula to create an indicator, but I'm not 100% clear on how to do so.

Can you shed some light to this newbie?

Thanks.
Bruce_L
Posted : Friday, January 26, 2007 2:34:45 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
stakano,
Tanstaafl's Monday, March 21, 2005 7:56:48 AM ET Post describes how to construct this as a formula. You would probably also wish to review:

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis

The formula is just designed to find the Widths for TeleChart's built in Linear Regression and Moving Linear Regression Channels. This would primarily be used in constructing Personal Criteria Formulas as an alternative to using Indicator Sorting.

If you explain what you want to do with the Custom Indicator, we might be able to help.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
stakano
Posted : Friday, January 26, 2007 3:28:30 PM
Registered User
Joined: 6/26/2005
Posts: 15
Thanks Bruce,

What I'm looking for is the ability to have the widths of the channels be more dynamic based on the highs and lows and exclude the extremes, just like bollinger bands, but more in a straight line.

What I'm hoping to find are the tops and bottoms in a channel a little better.

If someone has a better example, I'm willing to listen.

Thanks.
Bruce_L
Posted : Friday, January 26, 2007 3:37:29 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
stakano,
TeleChart's Custom Indicators don't really have a way to draw a straight line that looks like Linear Regression Line Channels. If you were to use this formula in a Custom Indicator or Custom Price Channel, the value will be calculated each day and not calculated at the end and drawn retroactively. The result would probably be a little straighter than Bollinger Bands, but would still curve up and down (you can add a Moving Linear Regression to Price to see what I mean).

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
hklala
Posted : Wednesday, August 4, 2010 1:16:16 PM
Registered User
Joined: 4/7/2010
Posts: 12
Bruce,
I would like to get the formula for Linear Regression (30, 0, 30).. I am assuiming this is Period 30 , Extention 0 and Standard Deviation of 3 or width 30.

Also I would like for Linear Regression (30, 0, 20). Could you please help me out..

Thanks
-Sid
Bruce_L
Posted : Wednesday, August 4, 2010 2:47:13 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
hklala,
Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:

If you are new to TeleChart READ THIS FIRST!

QUOTE (hklala)
I would like to get the formula for Linear Regression (30, 0, 30).. I am assuiming this is Period 30 , Extention 0 and Standard Deviation of 3 or width 30.

This very topic is about what Width represents in TeleChart's Linear Regression Channels. Read through it if you want to understand the calculations. The following formulas are for TeleChart's Width Calculations, the Modelling Bollinger Bands (& Standard Deviation) in a TC PCF topic explores how to calculate Standard Deviation.

Linear Regression 30,30:

AVGC30 + 14.5 * (14.5 * C + 13.5 * C1 + 12.5 * C2 + 11.5 * C3 + 10.5 * C4 + 9.5 * C5 + 8.5 * C6 + 7.5 * C7 + 6.5 * C8 + 5.5 * C9 + 4.5 * C10 + 3.5 * C11 + 2.5 * C12 + 1.5 * C13 + .5 * C14 - .5 * C15 - 1.5 * C16 - 2.5 * C17 - 3.5 * C18 - 4.5 * C19 - 5.5 * C20 - 6.5 * C21 - 7.5 * C22 - 8.5 * C23 - 9.5 * C24 - 10.5 * C25 - 11.5 * C26 - 12.5 * C27 - 13.5 * C28 - 14.5 * C29) / 2247.5

LR Upper Channel 30,30:

AVGC30 + 14.5 * (14.5 * C + 13.5 * C1 + 12.5 * C2 + 11.5 * C3 + 10.5 * C4 + 9.5 * C5 + 8.5 * C6 + 7.5 * C7 + 6.5 * C8 + 5.5 * C9 + 4.5 * C10 + 3.5 * C11 + 2.5 * C12 + 1.5 * C13 + .5 * C14 - .5 * C15 - 1.5 * C16 - 2.5 * C17 - 3.5 * C18 - 4.5 * C19 - 5.5 * C20 - 6.5 * C21 - 7.5 * C22 - 8.5 * C23 - 9.5 * C24 - 10.5 * C25 - 11.5 * C26 - 12.5 * C27 - 13.5 * C28 - 14.5 * C29) / 2247.5 + 30 * (ABS(C28 - AVGC2.28) + ABS(C27 - AVGC3.27) + ABS(C26 - AVGC4.26) + ABS(C25 - AVGC5.25) + ABS(C24 - AVGC6.24) + ABS(C23 - AVGC7.23) + ABS(C22 - AVGC8.22) + ABS(C21 - AVGC9.21) + ABS(C20 - AVGC10.20) + ABS(C19 - AVGC11.19) + ABS(C18 - AVGC12.18) + ABS(C17 - AVGC13.17) + ABS(C16 - AVGC14.16) + ABS(C15 - AVGC15.15) + ABS(C14 - AVGC16.14) + ABS(C13 - AVGC17.13) + ABS(C12 - AVGC18.12) + ABS(C11 - AVGC19.11) + ABS(C10 - AVGC20.10) + ABS(C9 - AVGC21.9) + ABS(C8 - AVGC22.8) + ABS(C7 - AVGC23.7) + ABS(C6 - AVGC24.6) + ABS(C5 - AVGC25.5) + ABS(C4 - AVGC26.4) + ABS(C3 - AVGC27.3) + ABS(C2 - AVGC28.2) + ABS(C1 - AVGC29.1) + ABS(C - AVGC30)) / 600

LR Lower Channel 30,30:

AVGC30 + 14.5 * (14.5 * C + 13.5 * C1 + 12.5 * C2 + 11.5 * C3 + 10.5 * C4 + 9.5 * C5 + 8.5 * C6 + 7.5 * C7 + 6.5 * C8 + 5.5 * C9 + 4.5 * C10 + 3.5 * C11 + 2.5 * C12 + 1.5 * C13 + .5 * C14 - .5 * C15 - 1.5 * C16 - 2.5 * C17 - 3.5 * C18 - 4.5 * C19 - 5.5 * C20 - 6.5 * C21 - 7.5 * C22 - 8.5 * C23 - 9.5 * C24 - 10.5 * C25 - 11.5 * C26 - 12.5 * C27 - 13.5 * C28 - 14.5 * C29) / 2247.5 - 30 * (ABS(C28 - AVGC2.28) + ABS(C27 - AVGC3.27) + ABS(C26 - AVGC4.26) + ABS(C25 - AVGC5.25) + ABS(C24 - AVGC6.24) + ABS(C23 - AVGC7.23) + ABS(C22 - AVGC8.22) + ABS(C21 - AVGC9.21) + ABS(C20 - AVGC10.20) + ABS(C19 - AVGC11.19) + ABS(C18 - AVGC12.18) + ABS(C17 - AVGC13.17) + ABS(C16 - AVGC14.16) + ABS(C15 - AVGC15.15) + ABS(C14 - AVGC16.14) + ABS(C13 - AVGC17.13) + ABS(C12 - AVGC18.12) + ABS(C11 - AVGC19.11) + ABS(C10 - AVGC20.10) + ABS(C9 - AVGC21.9) + ABS(C8 - AVGC22.8) + ABS(C7 - AVGC23.7) + ABS(C6 - AVGC24.6) + ABS(C5 - AVGC25.5) + ABS(C4 - AVGC26.4) + ABS(C3 - AVGC27.3) + ABS(C2 - AVGC28.2) + ABS(C1 - AVGC29.1) + ABS(C - AVGC30)) / 600

QUOTE (hklala)
Also I would like for Linear Regression (30, 0, 20).

This just involves changing the "30 *" to a "20 *" in the Upper and Lower Channel formulas:

LR Upper Channel 30,20:

AVGC30 + 14.5 * (14.5 * C + 13.5 * C1 + 12.5 * C2 + 11.5 * C3 + 10.5 * C4 + 9.5 * C5 + 8.5 * C6 + 7.5 * C7 + 6.5 * C8 + 5.5 * C9 + 4.5 * C10 + 3.5 * C11 + 2.5 * C12 + 1.5 * C13 + .5 * C14 - .5 * C15 - 1.5 * C16 - 2.5 * C17 - 3.5 * C18 - 4.5 * C19 - 5.5 * C20 - 6.5 * C21 - 7.5 * C22 - 8.5 * C23 - 9.5 * C24 - 10.5 * C25 - 11.5 * C26 - 12.5 * C27 - 13.5 * C28 - 14.5 * C29) / 2247.5 + 20 * (ABS(C28 - AVGC2.28) + ABS(C27 - AVGC3.27) + ABS(C26 - AVGC4.26) + ABS(C25 - AVGC5.25) + ABS(C24 - AVGC6.24) + ABS(C23 - AVGC7.23) + ABS(C22 - AVGC8.22) + ABS(C21 - AVGC9.21) + ABS(C20 - AVGC10.20) + ABS(C19 - AVGC11.19) + ABS(C18 - AVGC12.18) + ABS(C17 - AVGC13.17) + ABS(C16 - AVGC14.16) + ABS(C15 - AVGC15.15) + ABS(C14 - AVGC16.14) + ABS(C13 - AVGC17.13) + ABS(C12 - AVGC18.12) + ABS(C11 - AVGC19.11) + ABS(C10 - AVGC20.10) + ABS(C9 - AVGC21.9) + ABS(C8 - AVGC22.8) + ABS(C7 - AVGC23.7) + ABS(C6 - AVGC24.6) + ABS(C5 - AVGC25.5) + ABS(C4 - AVGC26.4) + ABS(C3 - AVGC27.3) + ABS(C2 - AVGC28.2) + ABS(C1 - AVGC29.1) + ABS(C - AVGC30)) / 600

LR Lower Channel 30,20:

AVGC30 + 14.5 * (14.5 * C + 13.5 * C1 + 12.5 * C2 + 11.5 * C3 + 10.5 * C4 + 9.5 * C5 + 8.5 * C6 + 7.5 * C7 + 6.5 * C8 + 5.5 * C9 + 4.5 * C10 + 3.5 * C11 + 2.5 * C12 + 1.5 * C13 + .5 * C14 - .5 * C15 - 1.5 * C16 - 2.5 * C17 - 3.5 * C18 - 4.5 * C19 - 5.5 * C20 - 6.5 * C21 - 7.5 * C22 - 8.5 * C23 - 9.5 * C24 - 10.5 * C25 - 11.5 * C26 - 12.5 * C27 - 13.5 * C28 - 14.5 * C29) / 2247.5 - 20 * (ABS(C28 - AVGC2.28) + ABS(C27 - AVGC3.27) + ABS(C26 - AVGC4.26) + ABS(C25 - AVGC5.25) + ABS(C24 - AVGC6.24) + ABS(C23 - AVGC7.23) + ABS(C22 - AVGC8.22) + ABS(C21 - AVGC9.21) + ABS(C20 - AVGC10.20) + ABS(C19 - AVGC11.19) + ABS(C18 - AVGC12.18) + ABS(C17 - AVGC13.17) + ABS(C16 - AVGC14.16) + ABS(C15 - AVGC15.15) + ABS(C14 - AVGC16.14) + ABS(C13 - AVGC17.13) + ABS(C12 - AVGC18.12) + ABS(C11 - AVGC19.11) + ABS(C10 - AVGC20.10) + ABS(C9 - AVGC21.9) + ABS(C8 - AVGC22.8) + ABS(C7 - AVGC23.7) + ABS(C6 - AVGC24.6) + ABS(C5 - AVGC25.5) + ABS(C4 - AVGC26.4) + ABS(C3 - AVGC27.3) + ABS(C2 - AVGC28.2) + ABS(C1 - AVGC29.1) + ABS(C - AVGC30)) / 600

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
MoreAces
Posted : Wednesday, January 27, 2016 10:13:26 PM
Registered User
Joined: 8/23/2013
Posts: 245

Bruce do these formulas work in TC2000, i keep getting syntax error

MoreAces
Posted : Wednesday, January 27, 2016 10:18:51 PM
Registered User
Joined: 8/23/2013
Posts: 245

if you wrote the last formulas above Linear, Upper, and Lower as 20,20 that would get the last /600 down under 500 bars and that would work on TC2000 v12 v16.

 

If so would you post here Thanks

Bruce_L
Posted : Thursday, January 28, 2016 10:24:25 AM


Worden Trainer

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

Yes, these formulas should all work in TC2000. I do not know why you would be getting a syntax error.

Are you using Internet Explorer or Edge when copying formulas from the forums into TC2000? If so, try copying and pasting the formula into Notepad and then copying and pasting the formula from Notepad into TC2000 instead of copying and pasting directly from the forums into TC2000.

Another option would be to use Chrome instead as it doesn't seem to be adding extra formatting like IE and Edge.

Note that these formulas are designed to get the values of the linear regression channels in TC2000 v7. You could use them in Custom PCF Indicators to try and replicate the Moving Linear Regression Channels from TC2000 v7 in TC2000 v12 or v16, but you would be able to use them to add channels to a Linear Regression Line indicator in v12 or v16.

The / 600 at the end of the formula does not mean it is using 600 bars of data. It is just a denominator designed to get the formula to return the correct value.Those formulas should actually only be using 30 bars of data.



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