Multiple Time Frame (MTF) Squeeze Indicator for ThinkorSwim

Hey Maverick thanks for your work. I have a question for you and anyone else using Squeezes. They definitely work as far as predicting breakouts but I'm still having a hell of a time figuring out which direction the breakout will go. Any insights?
Great question and this is where the 'discretionary' part of trading comes in. There are essentially two important things to note:

A. A squeeze represents a lack of movement in the underlying stock/ETF indicating volatility is low. This is the best time to buy options (calls or puts) because vol is cheap. The higher the timeframe the squeeze, the bigger the move is likely to be. John Carter mentions that once a squeeze fires (changes from blk/red/yellow to green) it should last 6-8 bars. If you want more of a directionally-agnostic approach, buy an iron-condor!

B. The histogram on the squeeze will tell you which direction the squeeze is likely to fire. I use the MTF labels to identify opportunities and then pull up the corresponding timeframe on the chart (w/ the squeeze pro lower) to get a better look at what I might be trading. If I'm choosing a direction here's my decision-making process, in order of importance:

#1 What is the prevailing trend? Is the stock pausing after a bullish move? Is the 21EMA above the 34EMA? While in a bullish consolidation/squeeze I will often buy pullbacks to the 21EMA via long calls/call spreads
#2 What is the histogram color on higher timeframes? If looking at a squeeze on the hourly - and the daily, weekly & monthly histogram colors are Cyan (indicating bullish sentiment) - I WILL NOT trade the H squeeze short no matter what it's histogram tells me. I will be buying calls.
#3 Lastly, what is the histogram color of the timeframe I'm trading in (that's squeezing)? This can be misleading and can 'fake you out' which is why I look at #1 & #2 first. For example: If higher timeframes are bullish, the hourly is squeezing and its histogram begins to turn up (cyan) then its a no-brainer to the long-side.

I rarely play the squeeze short as bullish setups are more abundant and generally offer better returns. If trading a daily or weekly squeeze try to enter trades on pullbacks to 21EMA on daily and 10SMA on Weekly. Be patient, as the market can CHOP before the squeeze fires. Take a position and be confident. Don't let the market shake you out. Not every trade or signal will work so keep your position size to 5%-10% of account. Be willing to lose and be patient on your winners. Remember the 6-8 bar rule of thumb. My fav. setup is weekly/monthly squeeze that has just fired...this means 6-8 weeks/months of positive price action. I then wait for 2H/Daily squeezes to get long in the direction of the prevailing trend. Once a squeeze has fired volatility increases so your calls will benefit both from direction and vol expansion. You can sell put spreads on pullbacks to 21EMA to help finance the cost of the calls. You will rarely time any of your trades perfectly - so stay patient and have conviction.

GOOD LUCK!
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@mmct Just use the built in TTM scanner, add in the amount of studies and set the aggregations to what you want. It is under licensed studies.
 
Hi guys! I've got this really great TTM_Squeeze replica by Mobius that I'm having trouble converting into MTF. Here is a 5 minute chart with the regular version next to the MTF version set to 5 minutes:

buFAfZ3.png


And here is the 1 minute chart with the MTF version set to 5 minutes. Notice how the CYAN portion and RED portions are not painting right? It paints one bar the right color followed by an orange bar.

MEP0t3S.png


Can anyone help me fix it?

Here is the code for the regular version:

Code:
# Momentum Squeeze and Volume Mod 08.17.18
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending
# Added UI for separate Squeeze and Oscillator lenghts

# This code precisely replicates TTM_Squeeze. At default settings
# the output is the same as TTM_Squeeze. Top is Momentum squeeze
# study and bottom is TTM_Squeeze. The Oscillator can be adjusted
# separately with this version. I prefer the oscillator at 13, as
# it makes it more timely
#
# Squeeze was originated by John Bollinger and the Momentum Oscillator
# has been around long before Carter's version. He just painted it
# those colors.
#
# Some years ago we ran some statistics on squeeze breakouts and
# it was right around 50/50 with some variance with price near high
# volume pivots being a bit more easily read.
#
# If there was a high volume pivot within 3 or 4 bars of a low and
# then a squeeze, the probability of an expansion in price upward was
# nearer 1 st dev. If there was a low volume high pivot near a squeeze
# the probability was for a downward expansion of price.
#
# Squeeze in those cases denotes the indecision (price compression)
# before a trend change. The same price compression is what the
# SuperTrend code picks up on

# Modified by blt, 7.26.2016
# Bars painted GRAY if we are in a squeeze, BLUE if we are long and
# ORANGE if we are short. Also added addverticalline when squeeze fires

declare lower;

input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;

def K = (Highest(high, Klength) + Lowest(low, Klength)) /
2 + ExpAverage(close, Klength);
plot Momo = Inertia(price - K / 2, Klength);
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.SetLineWeight(3);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.ORANGE
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
def SD = StDev(close, Slength);
def Avg = Average(close, Slength);
def ATR = Average(TrueRange(high, close, low), Slength);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.RED);
plot zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.POINTS);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.GREEN);
AddLabel(!IsNaN(Squeeze), "Squeeze", if IsAscending(Momo)
then Color.GREEN
else Color.RED);
# End Code - Momentum Squeeze

AddVerticalLine(!IsNaN(squeeze[1]) and IsNaN(squeeze), "Fired", Color.RED, Curve.FIRM);


#ADDED Volume###################################################################
#Colored Volume By Ethans080901
#Mod TroyX-8-17-18
#If today's closing price and volume is greater than 'n' days ago, color green
#If today's closing price is greater than 'n' days ago but volume is not, color blue
#If today's closing price is less than 'n' days ago, color orange
#If today's closing price is less than 'n' days ago but volume is not, color red

input n = 10;

def CN = Average(close, n);
def VN = Average(volume, n);
def G = close > CN and volume > VN ;
def B = close > CN and volume == VN;
def O = close < CN and volume == VN;
def R = close < CN and volume >= VN;

#Added volume Label
AddLabel( G, "Bullish Volume" , Color.CYAN); #Strong Bull
AddLabel( B, "Bullish Volume" , Color.blue); #Weak Bull
AddLabel( O, "Bearish Volume" , Color.YELLOW); #Weak Bear
AddLabel( R, "Bearish Volume" , Color.ORANGE); #Strong Bear

#How to use:
#Buy on Green or Blue
#Sell on Yellow or Orange

#End

And here is the MTF version I adapted:

# Momentum Squeeze and Volume Mod 08.17.18
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending
# Added UI for separate Squeeze and Oscillator lenghts

# This code precisely replicates TTM_Squeeze. At default settings
# the output is the same as TTM_Squeeze. Top is Momentum squeeze
# study and bottom is TTM_Squeeze. The Oscillator can be adjusted
# separately with this version. I prefer the oscillator at 13, as
# it makes it more timely
#
# Squeeze was originated by John Bollinger and the Momentum Oscillator
# has been around long before Carter's version. He just painted it
# those colors.
#
# Some years ago we ran some statistics on squeeze breakouts and
# it was right around 50/50 with some variance with price near high
# volume pivots being a bit more easily read.
#
# If there was a high volume pivot within 3 or 4 bars of a low and
# then a squeeze, the probability of an expansion in price upward was
# nearer 1 st dev. If there was a low volume high pivot near a squeeze
# the probability was for a downward expansion of price.
#
# Squeeze in those cases denotes the indecision (price compression)
# before a trend change. The same price compression is what the
# SuperTrend code picks up on

# Modified by blt, 7.26.2016
# Bars painted GRAY if we are in a squeeze, BLUE if we are long and
# ORANGE if we are short. Also added addverticalline when squeeze fires

declare lower;
input AGG = AggregationPeriod.FIVE_MIN;
input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
def price = close(period = AGG);
input SDmult = 2.0;
input ATRmult = 1.5;

def K = (Highest(high(period = AGG), Klength) + Lowest(low(period = AGG), Klength)) /
2 + ExpAverage(close(period = AGG), Klength);
plot Momo = Inertia(price - K / 2, Klength);
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.SetLineWeight(3);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.ORANGE
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
def SD = StDev(close(period = AGG), Slength);
def Avg = Average(close(period = AGG), Slength);
def ATR = Average(TrueRange(high(period = AGG), close(period = AGG), low(period = AGG)), Slength);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.RED);
plot zero = if IsNaN(close(period = AGG)) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.POINTS);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.GREEN);
AddLabel(!IsNaN(Squeeze), "Squeeze", if IsAscending(Momo)
then Color.GREEN
else Color.RED);
# End Code - Momentum Squeeze

AddVerticalLine(!IsNaN(squeeze[1]) and IsNaN(squeeze), "Fired", Color.RED, Curve.FIRM);


#ADDED Volume###################################################################
#Colored Volume By Ethans080901
#Mod TroyX-8-17-18
#If today's closing price and volume is greater than 'n' days ago, color green
#If today's closing price is greater than 'n' days ago but volume is not, color blue
#If today's closing price is less than 'n' days ago, color orange
#If today's closing price is less than 'n' days ago but volume is not, color red

input n = 10;

def CN = Average(close(period = AGG), n);
def VN = Average(volume(period = AGG), n);
def G = close(period = AGG) > CN and volume(period = AGG) > VN ;
def B = close(period = AGG) > CN and volume(period = AGG) == VN;
def O = close(period = AGG) < CN and volume(period = AGG) == VN;
def R = close(period = AGG) < CN and volume(period = AGG) >= VN;

#Added volume Label
AddLabel( G, "Bullish Volume" , Color.CYAN); #Strong Bull
AddLabel( B, "Bullish Volume" , Color.blue); #Weak Bull
AddLabel( O, "Bearish Volume" , Color.YELLOW); #Weak Bear
AddLabel( R, "Bearish Volume" , Color.ORANGE); #Strong Bear

#How to use:
#Buy on Green or Blue
#Sell on Yellow or Orange

#End

Thanks in advance!!!!!!!
 
Here is the FIXED version of MTF TTM_Squeeze lower histogram study!!

Code:
# Momentum Squeeze and Volume Mod 08.17.18
# Mobius
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending
# Added UI for separate Squeeze and Oscillator lenghts

# This code precisely replicates TTM_Squeeze. At default settings
# the output is the same as TTM_Squeeze. Top is Momentum squeeze
# study and bottom is TTM_Squeeze. The Oscillator can be adjusted
# separately with this version. I prefer the oscillator at 13, as
# it makes it more timely
#
# Squeeze was originated by John Bollinger and the Momentum Oscillator
# has been around long before Carter's version. He just painted it
# those colors.
#
# Some years ago we ran some statistics on squeeze breakouts and
# it was right around 50/50 with some variance with price near high
# volume pivots being a bit more easily read.
#
# If there was a high volume pivot within 3 or 4 bars of a low and
# then a squeeze, the probability of an expansion in price upward was
# nearer 1 st dev. If there was a low volume high pivot near a squeeze
# the probability was for a downward expansion of price.
#
# Squeeze in those cases denotes the indecision (price compression)
# before a trend change. The same price compression is what the
# SuperTrend code picks up on

# Modified by blt, 7.26.2016
# Bars painted GRAY if we are in a squeeze, BLUE if we are long and
# ORANGE if we are short. Also added addverticalline when squeeze fires

declare lower;

input AGG = AggregationPeriod.FIVE_MIN;
input Slength = 20; #hint Slength: Length for Squeeze
input Klength = 20; #hint Klength: Length for Oscillator
def price = close(period = AGG);
input SDmult = 2.0;
input ATRmult = 1.5;

def K = (Highest(high(period = AGG), Klength) + Lowest(low(period = AGG), Klength)) /
2 + ExpAverage(close(period = AGG), Klength);
plot Momo = Inertia(close - K/2, Klength);
Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Momo.SetLineWeight(3);
Momo.assignValueColor(if Momo > Momo[1] and Momo > 0
then Color.Cyan
else if Momo > 0 and Momo < Momo[1]
then Color.ORANGE
else if Momo < 0 and Momo < Momo[1]
then Color.Red
else Color.Yellow);
def SD = StDev(close(period = AGG), Slength);
def Avg = Average(close(period = AGG), Slength);
def ATR = Average(TrueRange(high(period = AGG), close(period = AGG), low(period = AGG)), Slength);
def SDup = Avg + (SDmult * SD);
def ATRup = Avg + (ATRmult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.RED);
plot zero = if IsNaN(close(period = AGG)) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.POINTS);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.GREEN);
AddLabel(!IsNaN(Squeeze), "Squeeze", if IsAscending(Momo)
then Color.GREEN
else Color.RED);
# End Code - Momentum Squeeze

AddVerticalLine(!IsNaN(squeeze[1]) and IsNaN(squeeze), "Fired", Color.RED, Curve.FIRM);


#ADDED Volume###################################################################
#Colored Volume By Ethans080901
#Mod TroyX-8-17-18
#If today's closing price and volume is greater than 'n' days ago, color green
#If today's closing price is greater than 'n' days ago but volume is not, color blue
#If today's closing price is less than 'n' days ago, color orange
#If today's closing price is less than 'n' days ago but volume is not, color red

input n = 10;

def CN = Average(close(period = AGG), n);
def VN = Average(volume(period = AGG), n);
def G = close(period = AGG) > CN and volume(period = AGG) > VN ;
def B = close(period = AGG) > CN and volume(period = AGG) == VN;
def O = close(period = AGG) < CN and volume(period = AGG) == VN;
def R = close(period = AGG) < CN and volume(period = AGG) >= VN;

#Added volume Label
AddLabel( G, "Bullish Volume" , Color.CYAN); #Strong Bull
AddLabel( B, "Bullish Volume" , Color.blue); #Weak Bull
AddLabel( O, "Bearish Volume" , Color.YELLOW); #Weak Bear
AddLabel( R, "Bearish Volume" , Color.ORANGE); #Strong Bear

#How to use:
#Buy on Green or Blue
#Sell on Yellow or Orange

#End

Link to the study:
https://tos.mx/Ib1UVWn
 
Should I start a new thread in the indicator forum with the correct version? I don't think anybody had made a MTF TTM_Squeeze lower histogram study yet.
 
Got it. That worked. Thank you!
Hello, How do i get the histogram labels to appear right below the Squeeze labels? They are all appearing in one line or the same line instead of in two separate rows on the chart. Please help on this. Thanks much..!!
 
@laketrader @noobstocktrader101 @horserider I am trying to figure out how to correct a new multi-Time frame increasing or decreasing histogram squeeze and was hoping to get some help. This works fine for the timeframe on the chart being used but it isn't working for any other timeframe. I think it has something to do with my formula for TTM Squeeze but I don't know what I am doing wrong. I am calling the TTM squeeze formula and then using the close for the timeframe I am looking for.


Any help would be appreciated.

Thank you,

Aaron

Code:
declare lower;

DefineGlobalColor("TrendUp", Color.GREEN);
DefineGlobalColor("TrendDown", Color.RED);

input higher_time_frame_4 = AggregationPeriod.WEEK;
input higher_time_frame_3 = AggregationPeriod.four_DAYS;
input higher_time_frame_2 = AggregationPeriod.three_days;
input higher_time_frame_1 = AggregationPeriod.two_days;

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;

def squeezeHist1 = reference TTM_Squeeze(close(period = higher_time_frame_1), 20, 1.5, 2.0, 1.0).Histogram;
def squeezeHist2 = reference TTM_Squeeze(close(period = higher_time_frame_2), 20, 1.5, 2.0, 1.0).Histogram;
def squeezeHist3 = reference TTM_Squeeze(close(period = higher_time_frame_3), 20, 1.5, 2.0, 1.0).Histogram;
def squeezeHist4 = reference TTM_Squeeze(close(period = higher_time_frame_4), 20, 1.5, 2.0, 1.0).Histogram;
def squeezeHist5 = reference TTM_Squeeze(close, 20, 1.5, 2.0, 1.0).Histogram;
plot HTF1 = if close then 4 else Double.NaN;
plot HTF2 = if close then 3 else Double.NaN;
plot HTF3 = if close then 2 else Double.NaN;
plot HTF4 = if close then 1 else Double.NaN;
plot HTF5 = if close then 0 else Double.NaN;

HTF1.SetPaintingStrategy(PaintingStrategy.POINTS);
HTF2.SetPaintingStrategy(PaintingStrategy.POINTS);
HTF3.SetPaintingStrategy(PaintingStrategy.POINTS);
HTF4.SetPaintingStrategy(PaintingStrategy.POINTS);
HTF5.SetPaintingStrategy(PaintingStrategy.POINTS);
HTF1.SetLineWeight(5);
HTF2.SetLineWeight(5);
HTF3.SetLineWeight(5);
HTF4.SetLineWeight(5);
HTF5.SetLineWeight(5);

HTF1.AssignValueColor(if squeezehist1 > squeezehist1[1] then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF2.AssignValueColor(if squeezehist2 > squeezehist2[1] then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF3.AssignValueColor(if squeezehist3 > squeezehist3[1] then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF4.AssignValueColor(if squeezehist4 > squeezehist4[1] then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
HTF5.AssignValueColor(if squeezehist5 > squeezehist5[1] then GlobalColor("TrendUp") else GlobalColor("TrendDown"));

HTF1.HideBubble();
HTF2.HideBubble();
HTF3.HideBubble();
HTF4.HideBubble();
HTF5.HideBubble();

HTF1.HideTitle();
HTF2.HideTitle();
HTF3.HideTitle();
HTF4.HideTitle();
HTF5.HideTitle();

plot divider = 5;
divider.SetDefaultColor(Color.GRAY);
divider.HideBubble();
divider.HideTitle();

def alignmentLong = if SQUEEZEHIST1 > squeezehist1[1] and SQUEEZEHIST2 > squeezehist2[1] and SQUEEZEHIST3 > squeezehist3[1] and SQUEEZEHIST4 > squeezehist4[1] and SQUEEZEHIST5 > squeezehist5[1] then 1 else 0;
def alignmentShort = if SQUEEZEHIST1 < squeezehist1[1] and SQUEEZEHIST2 < squeezehist2[1] and SQUEEZEHIST3 < squeezehist3[1] and SQUEEZEHIST4 < squeezehist4[1] and SQUEEZEHIST5 < squeezehist5[1] then 1 else 0;
plot combinedTrend = if alignmentLong then 6 else if alignmentShort then 6 else Double.NaN;
combinedTrend.SetPaintingStrategy(PaintingStrategy.POINTS);
combinedTrend.SetLineWeight(5);
combinedTrend.AssignValueColor(if alignmentLong then GlobalColor("TrendUp") else GlobalColor("TrendDown"));
combinedTrend.HideBubble();
combinedTrend.HideTitle();
 
Should I start a new thread in the indicator forum with the correct version? I don't think anybody had made a MTF TTM_Squeeze lower histogram study yet.
I created an MTF TTM Squeeze lower histogram but the formula for the TTM doesn't seem to work for timeframes other than the current timeframe I am looking at. The formula I am using is squeezeHist1 = reference TTM_Squeeze(close(period = higher_time_frame_1), 20, 1.5, 2.0, 1.0).Histogram;

If I can understand another formula for calculating the squeeze value I would be happy to update my study and repost.
 

Can any one make the multi cross indicator in this video. It seems to do the emas and charts as they cross over on several time frames. I see several posts here with the macd and such on multi time frames.

It seems that in the video, he says as the the color turns green on the 1 min chart, it is time to buy.

Thank you all for any help.
 
@horserider hey bro. Thanks for this. I saw several pages on this thread. Could you confirm which is the most accurate script of these for Squeeze?
And what timeframes does it cover?

Since this thread has multiple pages, I figured i'd ask the pro (you) :)
 
Guys need some help, on TTM SQUEEZE MTF. Would you trade backwards, meaning that you check the monthly and then go to the 1hr,daily, then the weekly?

Z4Yov6B.jpg
 
Last edited by a moderator:
oh yes i just was aksing because I noticed it for the regular and didn't see a mtf indicator but it's ok it, not a must-have thanks though appreciate d
 
All - I've been working on building a comparable setup to John Carter's squeeze pro labels + histogram labels.
...........

Thanks for the indicator.

is there a way for the labels to also display how many bars have been in the squeeze?

There's a TTM WL that does this with the regular sqz

Thanks
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
305 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top