Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/8/2007 Posts: 13
|
I want to include the drirection or slope of the 'linear regression' line into one of my scans. How can I do this?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The formula for the Slope of a Linear Regression Line would depend on your specific settings. We should be able to help you create a formula if you provide your particular settings.
Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/8/2007 Posts: 13
|
I simply want to know if the 50 day Linear Regression line is trending up or down. Could be a grade/slope percentage (pos/neg)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
One way to write a formula for the Slope of a 50-Period Linear Regression would be:
(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 + .5 * C24 - .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
You could return the sign of the Slope using (1 if positive and -1 if negative):
SGN(49 * (C - C49) + 47 * (C1 - C48) + 45 * (C2 - C47) + 43 * (C3 - C46) + 41 * (C4 - C45) + 39 * (C5 - C44) + 37 * (C6 - C43) + 35 * (C7 - C42) + 33 * (C8 - C41) + 31 * (C9 - C40) + 29 * (C10 - C39) + 27 * (C11 - C38) + 25 * (C12 - C37) + 23 * (C13 - C36) + 21 * (C14 - C35) + 19 * (C15 - C34) + 17 * (C16 - C33) + 15 * (C17 - C32) + 13 * (C18 - C31) + 11 * (C19 - C30) + 9 * (C20 - C29) + 7 * (C21 - C28) + 5 * (C22 - C27) + 3 * (C23 - C26) + C24 - C25)
So a formula that would return True when the 50-Period LR is positive would be:
49 * (C - C49) + 47 * (C1 - C48) + 45 * (C2 - C47) + 43 * (C3 - C46) + 41 * (C4 - C45) + 39 * (C5 - C44) + 37 * (C6 - C43) + 35 * (C7 - C42) + 33 * (C8 - C41) + 31 * (C9 - C40) + 29 * (C10 - C39) + 27 * (C11 - C38) + 25 * (C12 - C37) + 23 * (C13 - C36) + 21 * (C14 - C35) + 19 * (C15 - C34) + 17 * (C16 - C33) + 15 * (C17 - C32) + 13 * (C18 - C31) + 11 * (C19 - C30) + 9 * (C20 - C29) + 7 * (C21 - C28) + 5 * (C22 - C27) + 3 * (C23 - C26) + C24 - C25 > 0
And a formula that would return True when the 50-Period LR is negative would be:
49 * (C - C49) + 47 * (C1 - C48) + 45 * (C2 - C47) + 43 * (C3 - C46) + 41 * (C4 - C45) + 39 * (C5 - C44) + 37 * (C6 - C43) + 35 * (C7 - C42) + 33 * (C8 - C41) + 31 * (C9 - C40) + 29 * (C10 - C39) + 27 * (C11 - C38) + 25 * (C12 - C37) + 23 * (C13 - C36) + 21 * (C14 - C35) + 19 * (C15 - C34) + 17 * (C16 - C33) + 15 * (C17 - C32) + 13 * (C18 - C31) + 11 * (C19 - C30) + 9 * (C20 - C29) + 7 * (C21 - C28) + 5 * (C22 - C27) + 3 * (C23 - C26) + C24 - C25 < 0
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/8/2007 Posts: 13
|
Who better than you? .................."nobody!!!"
Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/4/2004 Posts: 8
|
Just curious, why wouldn't you simply sort the Regression Line using VISUAL CHANGE?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
janmart,
The primary reason I use Personal Criteria Formulas versus Indicator Sorting is speed. It doesn't make a lot of difference on a small Watchlist, but on large Watchlists, Indicator Sorting can be quite slow. In addition, if I am using the same Sort on multiple Watchlists, I only need to calculate my PCFs once where if I'm using Indicator Sorting, it will need to recalculate every time I change Watchlists.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |