Registered User Joined: 12/17/2004 Posts: 3

Has anyone been able to build the TTM squeeze indicator into blocks ?
thanks


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

My understanding (from TTM Squeeze Indicator) of the TTM Squeeze Indicator is the ratio of the width of a 20Period, 2SD Bollinger Band to the width of a Keltner Channel that uses 1.5 * the 20Period Simple Moving Average of True Range for its distance from centerline calculations. If this understanding is correct, you should be able to Plot TTM Squeeze using the following RealCode Indicator:
Static Sum As Single
Static SumSq As Single
Static BB As Single
Static Keltner As Single
If isFirstBar Then
Sum = 0
SumSq = 0
Keltner = 0
Else
Sum += Price.Last
SumSq += Price.Last^2
Keltner += 1.5*(System.Math.Max(Price.High,Price.Last(1))  _
System.Math.Min(Price.Low,Price.Last(1)))/20
If CurrentIndex >= 21 Then
Sum = Price.Last(20)
SumSq = Price.Last(20)^2
Keltner = 1.5*(System.Math.Max(Price.High(20),Price.Last(21))  _
System.Math.Min(Price.Low(20),Price.Last(21)))/20
End If
End If
If CurrentIndex >= 20 Then
BB = 2*((SumSq  Sum^2/20)/20)^.5
Plot = BB/Keltner
Else
Plot = Single.NaN
End If
You may also wish to review the following:
What do you get when you cross a Keltner Channel and Bollinger Bands?
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 1/13/2009 Posts: 3

what changes are required to make this work as a stock finder scan?


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

maxgoldfinger,
In StockFinder, you can just rightclick on the RealCode Indicator and select Create Rule to make a Rule for use as in a Filter, Scan or BackScan.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 9/23/2009 Posts: 2

Hi Bruce, i tried to copy and paste your Realcode above and it showed an error in line 26 and 28, which is the last 4 lines. The error is : Name 'Plot' is not declared.
Any advise? (i do not know anything about realcode, im simply pasting your code.)
Cheers!
Plot = BB/Keltner
Else
Plot = Single.NaN
End If


Administration
Joined: 9/30/2004 Posts: 9,167

It sounds like you're trying to paste the code into a RealCode Rule. "Plot" is not recognized in a rule. Click Add Indicator, Create in RealCode and paste code.


Registered User Joined: 12/18/2010 Posts: 5

Hello,
I have also copied and pasted the code to create the ttm squeeze indicator in stockfinder 5. I was wondering if someone could give a brief explanation about the levels we are looking for on the indicator.
For example, less than 1 is when the squeeze is on.
Or, as shown in the ttm video, if we plot the indicator as a bar chart, a possible exit signal is two consecutive declining bars.
Thanks


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

QUOTE (mrcauldwell) I have also copied and pasted the code to create the ttm squeeze indicator in stockfinder 5. I was wondering if someone could give a brief explanation about the levels we are looking for on the indicator.
The trainers can't give setting, interpretation or investment advice.
QUOTE (mrcauldwell) For example, less than 1 is when the squeeze is on.
Rightclick on the TTM Squeeze Indicator and select Create Condition  Less Than: 1.
Creating Conditions
QUOTE (mrcauldwell) Or, as shown in the ttm video, if we plot the indicator as a bar chart, a possible exit signal is two consecutive declining bars.
Rightclick on the TTM Squeeze Indicator and select Create Condition  Net Change  Less Than: 0  Passing 2 of the last 2 Bars.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 1/19/2012 Posts: 13

Hello, I am clicking on Add Indicator on a chart, than I click on Write Indicator Formula, than I copy paste your code and it says Formula Error in red?? Why isnt this working?
This is the formula I am copying/pasting:
Static Sum As Single
Static SumSq As Single
Static BB As Single
Static Keltner As Single
If isFirstBar Then
Sum = 0
SumSq = 0
Keltner = 0
Else
Sum += Price.Last
SumSq += Price.Last^2
Keltner += 1.5*(System.Math.Max(Price.High,Price.Last(1))  _
System.Math.Min(Price.Low,Price.Last(1)))/20
If CurrentIndex >= 21 Then
Sum = Price.Last(20)
SumSq = Price.Last(20)^2
Keltner = 1.5*(System.Math.Max(Price.High(20),Price.Last(21))  _
System.Math.Min(Price.Low(20),Price.Last(21)))/20
End If
End If
If CurrentIndex >= 20 Then
BB = 2*((SumSq  Sum^2/20)/20)^.5
Plot = BB/Keltner
Else
Plot = Single.NaN
End If


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

It is not working in TC2000 version 12 because it is not an Indicator Formula for TC2000 version 12. It is a RealCode Indicator for StockFinder.
You could use the following Indicator Formula as a Custom PCF Indicator in TC2000 version 12 to duplicate this RealCode Indicator:
2 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2  20 * AVGC20 ^ 2) / 20) / (1.5 * (AVGH20  AVGL20) / 2 + (ABS(H  C1) + ABS(C1  L) + ABS(H1  C2) + ABS(C2  L1) + ABS(H2  C3) + ABS(C3  L2) + ABS(H3  C4) + ABS(C4  L3) + ABS(H4  C5) + ABS(C5  L4) + ABS(H5  C6) + ABS(C6  L5) + ABS(H6  C7) + ABS(C7  L6) + ABS(H7  C8) + ABS(C8  L7) + ABS(H8  C9) + ABS(C9  L8) + ABS(H9  C10) + ABS(C10  L9) + ABS(H10  C11) + ABS(C11  L10) + ABS(H11  C12) + ABS(C12  L11) + ABS(H12  C13) + ABS(C13  L12) + ABS(H13  C14) + ABS(C14  L13) + ABS(H14  C15) + ABS(C15  L14) + ABS(H15  C16) + ABS(C16  L15) + ABS(H16  C17) + ABS(C17  L16) + ABS(H17  C18) + ABS(C18  L17) + ABS(H18  C19) + ABS(C19  L18) + ABS(H19  C20) + ABS(C20  L19)) / 40)
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 2/21/2016 Posts: 2

Hi! I try to copy this code into Custom PCF Indicator:
2 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2  20 * AVGC20 ^ 2) / 20) / (1.5 * (AVGH20  AVGL20) / 2 + (ABS(H  C1) + ABS(C1  L) + ABS(H1  C2) + ABS(C2  L1) + ABS(H2  C3) + ABS(C3  L2) + ABS(H3  C4) + ABS(C4  L3) + ABS(H4  C5) + ABS(C5  L4) + ABS(H5  C6) + ABS(C6  L5) + ABS(H6  C7) + ABS(C7  L6) + ABS(H7  C8) + ABS(C8  L7) + ABS(H8  C9) + ABS(C9  L8) + ABS(H9  C10) + ABS(C10  L9) + ABS(H10  C11) + ABS(C11  L10) + ABS(H11  C12) + ABS(C12  L11) + ABS(H12  C13) + ABS(C13  L12) + ABS(H13  C14) + ABS(C14  L13) + ABS(H14  C15) + ABS(C15  L14) + ABS(H15  C16) + ABS(C16  L15) + ABS(H16  C17) + ABS(C17  L16) + ABS(H17  C18) + ABS(C18  L17) + ABS(H18  C19) + ABS(C19  L18) + ABS(H19  C20) + ABS(C20  L19)) / 40)
...but i get this error: Argument missing near *
What do i do wrong?


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

Does your computer use the , as as the decimal marker instead of a . as would be more common in the United States? If so, please try the following instead.
2 * SQR(ABS(C ^ 2 + C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2  20 * AVGC20 ^ 2) / 20) / (3 * (AVGH20  AVGL20) / 4 + (ABS(H  C1) + ABS(C1  L) + ABS(H1  C2) + ABS(C2  L1) + ABS(H2  C3) + ABS(C3  L2) + ABS(H3  C4) + ABS(C4  L3) + ABS(H4  C5) + ABS(C5  L4) + ABS(H5  C6) + ABS(C6  L5) + ABS(H6  C7) + ABS(C7  L6) + ABS(H7  C8) + ABS(C8  L7) + ABS(H8  C9) + ABS(C9  L8) + ABS(H9  C10) + ABS(C10  L9) + ABS(H10  C11) + ABS(C11  L10) + ABS(H11  C12) + ABS(C12  L11) + ABS(H12  C13) + ABS(C13  L12) + ABS(H13  C14) + ABS(C14  L13) + ABS(H14  C15) + ABS(C15  L14) + ABS(H15  C16) + ABS(C16  L15) + ABS(H16  C17) + ABS(C17  L16) + ABS(H17  C18) + ABS(C18  L17) + ABS(H18  C19) + ABS(C19  L18) + ABS(H19  C20) + ABS(C20  L19)) / 40)
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 4/3/2014 Posts: 22

Can we get a final version of the ttm squeeze? I looked through all the posts and couldn't find the final one because there were soo many. thanks in advance


Registered User Joined: 5/25/2017 Posts: 1

Hello Bruce can you please send me the TTM Squeeze indicator? I am trying to get it on my TC 2000.
Thanks in advance!
 Andrew


Gold Customer
Joined: 6/6/2017 Posts: 1

Hi Bruce, can you please send me the TTM Squeeze indicator as well.
Thanks,,
Rob


Worden Trainer
Joined: 10/7/2004 Posts: 64,759

I have sent you a TCMail with a chart containing the TTM Squeeze indicator.
Bruce Personal Criteria Formulas TC2000 Support Articles


Guest1 