Registered User Joined: 3/17/2016 Posts: 48
|
As most of us know, the original John Carter TTM squeeze uses the momentum plot. Whilst it's good, there is another implementation which is equally as good. Currently, it is the most popular formula in TradingView public library and uses linear regression rather than momentum.
Bruce can you help me in constructing a PCF Indicator using Linear Regression.
The below link is LazyBears (Chris Moody's) implementation of TTM Squeeze using linear regression.
https://www.tradingview.com/v/nqQ1DT5a/
An excerpt of the formula using linear regression is defined below:
linreg(source - avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)),
lengthKC,0)
Please refer to the TradingView link above for full formula. I just need the formula for the linear regression plot.
|
|
Registered User Joined: 3/17/2016 Posts: 48
|
If the above link does not work, try this:
https://www.tradingview.com/script/nqQ1DT5a-Squeeze-Momentum-Indicator-LazyBear/
Many thanks in advance.
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
It's a holiday, and having washed down my burger with a beer (or two, or...) I didn't examine the TradingView formula too closely. Having said that, I do see references to a linear regression, a moving average, and a high and a low suggesting possibly a range.
My buddy Bruce's implementation of the TTM Squeeze uses a PCF provided by diceman in the Monday, February 10, 2014 10:41:09 AM ET post in the TTM squeeze revisited topic. I'm pretty sure Bruce mentioned that "it appears to be the 20 period moving linear regression of the difference between the 20 period simple moving average and the center of the 20 period range."
Sounds like they're similar. It'll be interesting to see what Bruce has to say when he returns from his yacht in the Hamptons. That is, if Hermine didn't get him first.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am pretty sure Putt4Dough is correct and the formula provided by diceman is what you want.
AVGC20 - ((AVG(MAXH20,20) + AVG(MINL20,20)) / 2 + XAVG(AVGC20,20)) / 2 + 9.5 * (9.5 * (C - ((MAXH20 + MINL20) / 2 + XAVGC20) / 2) + 8.5 * (C1 - ((MAXH20.1 + MINL20.1) / 2 + XAVGC20.1) / 2) + 7.5 * (C2 - ((MAXH20.2 + MINL20.2) / 2 + XAVGC20.2) / 2) + 6.5 * (C3 - ((MAXH20.3 + MINL20.3) / 2 + XAVGC20.3) / 2) + 5.5 * (C4 - ((MAXH20.4 + MINL20.4) / 2 + XAVGC20.4) / 2) + 4.5 * (C5 - ((MAXH20.5 + MINL20.5) / 2 + XAVGC20.5) / 2) + 3.5 * (C6 - ((MAXH20.6 + MINL20.6) / 2 + XAVGC20.6) / 2) + 2.5 * (C7 - ((MAXH20.7 + MINL20.7) / 2 + XAVGC20.7) / 2) + 1.5 * (C8 - ((MAXH20.8 + MINL20.8) / 2 + XAVGC20.8) / 2) + .5 * (C9 - ((MAXH20.9 + MINL20.9) / 2 + XAVGC20.9) / 2) - .5 * (C10 - ((MAXH20.10 + MINL20.10) / 2 + XAVGC20.10) / 2) - 1.5 * (C11 - ((MAXH20.11 + MINL20.11) / 2 + XAVGC20.11) / 2) - 2.5 * (C12 - ((MAXH20.12 + MINL20.12) / 2 + XAVGC20.12) / 2) - 3.5 * (C13 - ((MAXH20.13 + MINL20.13) / 2 + XAVGC20.13) / 2) - 4.5 * (C14 - ((MAXH20.14 + MINL20.14) / 2 + XAVGC20.14) / 2) - 5.5 * (C15 - ((MAXH20.15 + MINL20.15) / 2 + XAVGC20.15) / 2) - 6.5 * (C16 - ((MAXH20.16 + MINL20.16) / 2 + XAVGC20.16) / 2) - 7.5 * (C17 - ((MAXH20.17 + MINL20.17) / 2 + XAVGC20.17) / 2) - 8.5 * (C18 - ((MAXH20.18 + MINL20.18) / 2 + XAVGC20.18) / 2) - 9.5 * (C19 - ((MAXH20.19 + MINL20.19) / 2 + XAVGC20.19) / 2)) / 665
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
Thanks, Bruce. Welcome back!
|
|
Registered User Joined: 3/10/2012 Posts: 465
|
Hey Bruce in your this Sept 07th formula i wish to do tweak and do some comparison can u please write a pcf as follows
your PCF today (below zero) is higher then it was yesterday and yesterday was their lowest value at -least for the 3 bars prior to that , ( what i m trying to do is find a bottom using histogram with the pcf you did as above )
and if you can do the same for inverse above zero where the pcf today is Lower then the pcf yesterday and yesterday was the highest value at least for the 3 bars prior to that
thanks Cheers
Dhiren
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Do you really need it as a PCF? It is going to be a fairly long formula.
You could scan for this by using the formula in a Custom PCF Indicator. Then add a 1 period moving average offset by 1 and Donchian Channels with a period of 3 and offset of 2 to the Custom PCF Indicator.
You would click in the Custom PCF Indicator and select Create Scan Condition to create conditions for less than 0 and moving up.
You would click on the offset moving average and check for it being below the lower Donchian Channel.
You would add all three conditions to the same EasyScan.
Create Conditions from Your Chart (5:25)
How to Create an EasyScan and save it to the Library
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
QUOTE (Bruce_L) You could scan for this by using the formula in a Custom PCF Indicator. Then add a 1 period moving average offset by 1 and Donchian Channels with a period of 3 and offset of 2 to the Custom PCF Indicator.
You would click in the Custom PCF Indicator and select Create Scan Condition to create condition for less than 0 and moving up.
You would click on the offset moving average and check for it being below the lower Donchian Channel.
You would add all three conditions to the same EasyScan.
I have a relatively small watchlist of symbols that I trade, so I've been eyeballing the histogram tops and bottoms, but I like this idea.
One period moving averages offset by one are a beautiful thing. Same with Donchian Channels. :)
|
|
Registered User Joined: 3/10/2012 Posts: 465
|
Thanks Bruce i did the way you mentioned , i guess there is not much to find in today's market !
I will use this idea on few other historgrams and see if that can generate good signals
Aprreciate Cheers
Dhiren
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
Hi Bruce,
Since diceman's momentum plot that's part of your TTM Squeeze indicator is a 20-period moving linear regression (of the difference between the 20-period simple moving average and the center of the 20-period range) is it possible to create PCFs for the Linear Regression Slope and R-Squared?
Given more than one candidate meeting my other conditions, it'd be nice to scan and/or sort by Slope & R-Squared.
Thanks!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The linear regression slope portion of the formula is the following.
(9.5 * (C - ((MAXH20 + MINL20) / 2 + XAVGC20) / 2) + 8.5 * (C1 - ((MAXH20.1 + MINL20.1) / 2 + XAVGC20.1) / 2) + 7.5 * (C2 - ((MAXH20.2 + MINL20.2) / 2 + XAVGC20.2) / 2) + 6.5 * (C3 - ((MAXH20.3 + MINL20.3) / 2 + XAVGC20.3) / 2) + 5.5 * (C4 - ((MAXH20.4 + MINL20.4) / 2 + XAVGC20.4) / 2) + 4.5 * (C5 - ((MAXH20.5 + MINL20.5) / 2 + XAVGC20.5) / 2) + 3.5 * (C6 - ((MAXH20.6 + MINL20.6) / 2 + XAVGC20.6) / 2) + 2.5 * (C7 - ((MAXH20.7 + MINL20.7) / 2 + XAVGC20.7) / 2) + 1.5 * (C8 - ((MAXH20.8 + MINL20.8) / 2 + XAVGC20.8) / 2) + .5 * (C9 - ((MAXH20.9 + MINL20.9) / 2 + XAVGC20.9) / 2) - .5 * (C10 - ((MAXH20.10 + MINL20.10) / 2 + XAVGC20.10) / 2) - 1.5 * (C11 - ((MAXH20.11 + MINL20.11) / 2 + XAVGC20.11) / 2) - 2.5 * (C12 - ((MAXH20.12 + MINL20.12) / 2 + XAVGC20.12) / 2) - 3.5 * (C13 - ((MAXH20.13 + MINL20.13) / 2 + XAVGC20.13) / 2) - 4.5 * (C14 - ((MAXH20.14 + MINL20.14) / 2 + XAVGC20.14) / 2) - 5.5 * (C15 - ((MAXH20.15 + MINL20.15) / 2 + XAVGC20.15) / 2) - 6.5 * (C16 - ((MAXH20.16 + MINL20.16) / 2 + XAVGC20.16) / 2) - 7.5 * (C17 - ((MAXH20.17 + MINL20.17) / 2 + XAVGC20.17) / 2) - 8.5 * (C18 - ((MAXH20.18 + MINL20.18) / 2 + XAVGC20.18) / 2) - 9.5 * (C19 - ((MAXH20.19 + MINL20.19) / 2 + XAVGC20.19) / 2)) / 665
The r-squared you want might be the following, but I'm really not sure. It seems wrong because the values don't fall into the expected range.
(((((20 - 1) / 2) * (AVGC20 - ((AVG(MAXH20,20) + AVG(MINL20,20)) / 2 + XAVG(AVGC20,20)) / 2) ^ 2 - ((C1 - ((MAXH20.1 + MINL20.1) / 2 + XAVGC20.1) / 2) + 2 * (C2 - ((MAXH20.2 + MINL20.2) / 2 + XAVGC20.2) / 2) + 3 * (C3 - ((MAXH20.3 + MINL20.3) / 2 + XAVGC20.3) / 2) + 4 * (C4 - ((MAXH20.4 + MINL20.4) / 2 + XAVGC20.4) / 2) + 5 * (C5 - ((MAXH20.5 + MINL20.5) / 2 + XAVGC20.5) / 2) + 6 * (C6 - ((MAXH20.6 + MINL20.6) / 2 + XAVGC20.6) / 2) + 7 * (C7 - ((MAXH20.7 + MINL20.7) / 2 + XAVGC20.7) / 2) + 8 * (C8 - ((MAXH20.8 + MINL20.8) / 2 + XAVGC20.8) / 2) + 9 * (C9 - ((MAXH20.9 + MINL20.9) / 2 + XAVGC20.9) / 2) + 10 * (C10 - ((MAXH20.10 + MINL20.10) / 2 + XAVGC20.10) / 2) + 11 * (C11 - ((MAXH20.11 + MINL20.11) / 2 + XAVGC20.11) / 2) + 12 * (C12 - ((MAXH20.12 + MINL20.12) / 2 + XAVGC20.12) / 2) + 13 * (C13 - ((MAXH20.13 + MINL20.13) / 2 + XAVGC20.13) / 2) + 14 * (C14 - ((MAXH20.14 + MINL20.14) / 2 + XAVGC20.14) / 2) + 15 * (C15 - ((MAXH20.15 + MINL20.15) / 2 + XAVGC20.15) / 2) + 16 * (C16 - ((MAXH20.16 + MINL20.16) / 2 + XAVGC20.16) / 2) + 17 * (C17 - ((MAXH20.17 + MINL20.17) / 2 + XAVGC20.17) / 2) + 18 * (C18 - ((MAXH20.18 + MINL20.18) / 2 + XAVGC20.18) / 2) + 19 * (C19 - ((MAXH20.19 + MINL20.19) / 2 + XAVGC20.19) / 2)) / 20) / SQR(((20 ^ 2 - 1) / 12) * (((C - ((MAXH20 + MINL20) / 2 + XAVGC20) / 2) ^ 2 + (C1 - ((MAXH20.1 + MINL20.1) / 2 + XAVGC20.1) / 2) ^ 2 + (C2 - ((MAXH20.2 + MINL20.2) / 2 + XAVGC20.2) / 2) ^ 2 + (C3 - ((MAXH20.3 + MINL20.3) / 2 + XAVGC20.3) / 2) ^ 2 + (C4 - ((MAXH20.4 + MINL20.4) / 2 + XAVGC20.4) / 2) ^ 2 + (C5 - ((MAXH20.5 + MINL20.5) / 2 + XAVGC20.5) / 2) ^ 2 + (C6 - ((MAXH20.6 + MINL20.6) / 2 + XAVGC20.6) / 2) ^ 2 + (C7 - ((MAXH20.7 + MINL20.7) / 2 + XAVGC20.7) / 2) ^ 2 + (C8 - ((MAXH20.8 + MINL20.8) / 2 + XAVGC20.8) / 2) ^ 2 + (C9 - ((MAXH20.9 + MINL20.9) / 2 + XAVGC20.9) / 2) ^ 2 + (C10 - ((MAXH20.10 + MINL20.10) / 2 + XAVGC20.10) / 2) ^ 2 + (C11 - ((MAXH20.11 + MINL20.11) / 2 + XAVGC20.11) / 2) ^ 2 + (C12 - ((MAXH20.12 + MINL20.12) / 2 + XAVGC20.12) / 2) ^ 2 + (C13 - ((MAXH20.13 + MINL20.13) / 2 + XAVGC20.13) / 2) ^ 2 + (C14 - ((MAXH20.14 + MINL20.14) / 2 + XAVGC20.14) / 2) ^ 2 + (C15 - ((MAXH20.15 + MINL20.15) / 2 + XAVGC20.15) / 2) ^ 2 + (C16 - ((MAXH20.16 + MINL20.16) / 2 + XAVGC20.16) / 2) ^ 2 + (C17 - ((MAXH20.17 + MINL20.17) / 2 + XAVGC20.17) / 2) ^ 2 + (C18 - ((MAXH20.18 + MINL20.18) / 2 + XAVGC20.18) / 2) ^ 2 + (C19 - ((MAXH20.19 + MINL20.19) / 2 + XAVGC20.19) / 2)) / 20 - (AVGC20 - ((AVG(MAXH20,20) + AVG(MINL20,20)) / 2 + XAVG(AVGC20,20)) / 2) ^ 2))) ^ 2)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
Cool, Bruce. The R-Squared value would really help if you can pull it off. The Slope is a great start but the R-Squared will tell us the strength of the correlation of the data that created that Slope. The higher the correlation, the better, generally speaking. But you already knew that. :)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There seems to be something seriously wrong with my r-squared attempt. But as far as I can tell, I substituted all the values in the right places.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/30/2007 Posts: 1,072
|
QUOTE (Bruce_L) There seems to be something seriously wrong with my r-squared attempt. But as far as I can tell, I substituted all the values in the right places.
Haven't tried it yet on my end. Maybe put it down, move on to something else, and come back to it fresh? A break, a shower, or a nap usually work for me. ;)
|
|
Guest-1 |