TTM SQUEEZE INDICATOR

Hi:

wondering if anyone is familiar with the TTM SQUEEZE INDICATOR created by John carter from simpler options.

The nature of this indicator is the bollinger bands set at 20 days with 1.5 stddev and Keltner channels with 20 and 1 stddev and the momentum oscillator on 14 days .

When the bollinger bands contract together in to the Keltner channel and then break out of the Keltner channel it is said that the squeeze has fired and the momentum histogram shows the direction of the move up or down.

I managed to find a functioning version of this indicator on Tradingview platform,however i would prefer to build this indicator to use on Optuma.

The script is also available on tradingview however the script language is not the same as the Optuma language.

 

This indicator is very useful and much easier on the eyes than plotting all three tools on the charts.

Here is an image and also a link of what it does exactly.

 

https://www.youtube.com/watch?v=JVeBrkHdSY4

 

 

ttm squeeze on tradingview

Thanks in advance

I'm wondering if someone here cleverer than me would be able to write this script and and make the settings user adjustable.

Hi,

Thank you for your post. I’ll have a look at the rules and examples in your post and will see if it can be setup as a script. If it can i’ll post an example here.

Hi,

Please find an example script below of the TTM Squeeze Indicator in Optuma:

UpperBB = BB(BARS=20, DEFAULT=UpperLine);
LowerBB = BB(BARS=20, DEFAULT=LowerLine);
UpperKC = KC(BARS=20, CONST=1.500000);
LowerKC = KC(BARS=20, CONST=1.500000, DEFAULT=LowerLine);

value1 = (HIGHESTHIGH(BARS=20) + LOWESTLOW(BARS=20) + MA(BARS=20, CALC=Close)) / 3;
value2 = CLOSE() - value1;
val = LRSLOPE(value2, BARS=20);

sqzOn = LowerBB > LowerKC and UpperBB < UpperKC;

p1 = IF(val > 0 and val > val[1], val, 0);
p2 = IF(val > 0 and val < val[1], val, 0);
p3 = IF(val < 0 and val < val[1], val, 0);
p4 = IF(val < 0 and val > val[1], val, 0);
sqz1 = IF(sqzOn > 0, 5, 0);
sqz2 = IF(sqzOn <= 0, 5, 0);

Plot1 = p1;
Plot1.Color = Blue;
Plot1.Plotstyle = Histogram;
Plot2 = p2;
Plot2.Color = Navy;
Plot2.Plotstyle = Histogram;
Plot3 = p3;
Plot3.Color = Red;
Plot3.Plotstyle = Histogram;
Plot4 = p4;
Plot4.Color = Yellow;
Plot4.Plotstyle = Histogram;
Plot5 = sqz1;
Plot5.Color = Red;
Plot5.Plotstyle = Dot;
Plot6 = sqz2;
Plot6.Color = Green;
Plot6.Plotstyle = Dot;

This should be added to a Show View tool.

Here’s an example of how it looks when applied to the DAX:

DAXX

Hi,

I don’t understand what that line at the top of the indicator window is. It also kind of pushes the oscillator down making it small in size. In certain cases the oscillator cannot be seen at all. (This is the WDC daily chart. The second one is the original daily chart from Think-or-Swim.).

Your help is appreciated.

Julius Mohacsi

 

Hi,

Those dots come from lines 17 and 18 in the code that was posted.

sqz1 = IF(sqzOn > 0, 5, 0);
sqz2 = IF(sqzOn <= 0, 5, 0);

They are hard coded to use a value of 5 which works fine for the DAXX (the original chart the script was built on) but not for WDC as the values of the indicator are much smaller.

Changing the values from 5 to 0.1 in the case of WDC will adjust the code to display as expected.

Ex4

Thank you, Matthew!
I still do not understand why this extra line exists. I can see that the red/green areas are just the opposite of those of the zero line.
Can this extra line be placed over (instead of) the zero line? Or simply change the red/green areas of the zero line and delete this extra line?
Thank you again.
Julius

Hello,

I have tried to copy the above script and place it in the show view tool, but it is not reading it as a valid script. Have I missed a step? See attached.
Error

Hi,

Did you copy the code from the forum into Notepad first, then copy the code from Notepad into Optuma?

If you copied it directly from the webpage, there could be some special characters included in the copy that prevent the script from working. By copying the script into notepad first, these special characters are removed, which should allow the script to work.

I have tried copying it from the website into the notepad, then into the show view tool but I am still running into the same issue

I am not sure why the copy past option isn’t working for you. I’ve attached a copy in a workbook, please try opening it up and the indicator should show along the bottom of the chart.

From there you should be able to save the script to your script manager / tool bar.

TTMSqueeze.owb (13.4 KB)