Multiple Time Frame (MTF) Squeeze Indicator for ThinkorSwim

J

jhorton56

New member
VIP
Can you explain a little about the two studies on the right side of your grid, the Theo Trade Cumulative QuanTicks, and the comparison of CANDLE and $ADSPD?
 
V

venkat

New member
Thanks @maverick0987

Looks like there is an issue(if I am not wrong) in the TTM squeeze label colors - I dont see black and Orange in the label code.. Can you please check.
 
Last edited:
M

maverick0987

New member
Thanks @maverick0987

Looks like there is an issue(if I am not wrong) in the TTM squeeze label colors - I dont see black and Orange in the label code.. Can you please check.
I used gray and yellow instead of black and orange b/c the background of my chart is black. I chose colors that work better for my eyes. I believe John uses the same colors
 
M

maverick0987

New member
Can you explain a little about the two studies on the right side of your grid, the Theo Trade Cumulative QuanTicks, and the comparison of CANDLE and $ADSPD?
I use ticks to avoid shorting on a day when buying pressure is high and vice-versa. You can google tick charts & Corey Rosenbloom to learn more about this. $ADSPD is Advance-Decline, which is just another market internal indicator. The Quanticks is just showing cumulative activity in the ticks from the cash open.
 
M

maverick0987

New member
Do you have the link to the $ADSPD Advance-Decline?
All I did for that is goto the "Comparison" indicator already in TOS and move it from the upper to the lower portion of the chart (it will default to upper). Then type in $ADSPD as the ticker within the indicator parameters. Voila!
 
S

SoXoS

New member
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?
 
M

mmct

New member
Not sure about the blank spots but this is my version of the squeeze with MORE DOTS!
There are 6 aggregations, you can pick the "vote" for the topline to show is "x" of 6 are in line with each other.

Code:
declare lower;
input AP1 = AggregationPeriod.DAY;
input AP2 = AggregationPeriod.TWO_DAYS;
input AP3 = AggregationPeriod.THREE_DAYS;
input AP4 = AggregationPeriod.FOUR_DAYS;
input AP5 = AggregationPeriod.WEEK;
input AP6 = AggregationPeriod.MONTH;
input vote = 3;

def price1 = CLOSE(period = AP1);
def price2 = CLOSE(period = AP2);
def price3 = CLOSE(period = AP3);
def price4 = CLOSE(period = AP4);
def price5 = CLOSE(period = AP5);
def price6 = CLOSE(period = AP6);
def length = 20;
def nK = 1.5;
def nBB = 2.0;
def alertLine = 1.0;
def Sqz_Length = 3;

def squeezeDots1 = TTM_Squeeze(price1, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots2 = TTM_Squeeze(price2, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots3 = TTM_Squeeze(price3, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots4 = TTM_Squeeze(price4, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots5 = TTM_Squeeze(price5, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots6 = TTM_Squeeze(price6, length, nK, nBB, alertLine).SqueezeAlert;



def Top_Plot = (squeezeDots1 + squeezeDots2 + squeezeDots3 + squeezeDots4 +  squeezeDots5 +squeezeDots6) >= Vote;

plot MTF_Sqz = 7;
MTF_Sqz.SetPaintingStrategy(PaintingStrategy.POINTS);
MTF_Sqz.AssignValueColor(if Top_Plot == 1 then Color.BLACK else Color.DARK_RED);
MTF_Sqz.SetLineWeight(5);

plot Sqeezy1 = if squeezeDots1 == 1 then squeezeDots1 + 5 else 6;
plot Sqeezy2 = if squeezeDots2 == 1 then squeezeDots2 + 4 else 5;
plot Sqeezy3 = if squeezeDots3 == 1 then squeezeDots3 + 3 else 4;
plot Sqeezy4 = if squeezeDots4 == 1 then squeezeDots4 + 2 else 3;
plot Sqeezy5 = if squeezeDots5 == 1 then squeezeDots5 + 1 else 2;
plot Sqeezy6 = if squeezeDots6 == 1 then squeezeDots6 else 1;

Sqeezy1.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy1.AssignValueColor(if squeezeDots1 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy1.SetLineWeight(3);
Sqeezy2.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy2.AssignValueColor(if squeezeDots2 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy2.SetLineWeight(3);
Sqeezy3.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy3.AssignValueColor(if squeezeDots3 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy3.SetLineWeight(3);
Sqeezy4.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy4.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy4.SetLineWeight(3);
Sqeezy5.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy5.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy5.SetLineWeight(3);
Sqeezy6.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy6.AssignValueColor(if squeezeDots6 == 1 then Color.DARK_GREEN else  Color.DARK_RED);
Sqeezy6.SetLineWeight(3);
Not sure about the blank spots but this is my version of the squeeze with MORE DOTS!
There are 6 aggregations, you can pick the "vote" for the topline to show is "x" of 6 are in line with each other.

Code:
declare lower;
input AP1 = AggregationPeriod.DAY;
input AP2 = AggregationPeriod.TWO_DAYS;
input AP3 = AggregationPeriod.THREE_DAYS;
input AP4 = AggregationPeriod.FOUR_DAYS;
input AP5 = AggregationPeriod.WEEK;
input AP6 = AggregationPeriod.MONTH;
input vote = 3;

def price1 = CLOSE(period = AP1);
def price2 = CLOSE(period = AP2);
def price3 = CLOSE(period = AP3);
def price4 = CLOSE(period = AP4);
def price5 = CLOSE(period = AP5);
def price6 = CLOSE(period = AP6);
def length = 20;
def nK = 1.5;
def nBB = 2.0;
def alertLine = 1.0;
def Sqz_Length = 3;

def squeezeDots1 = TTM_Squeeze(price1, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots2 = TTM_Squeeze(price2, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots3 = TTM_Squeeze(price3, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots4 = TTM_Squeeze(price4, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots5 = TTM_Squeeze(price5, length, nK, nBB, alertLine).SqueezeAlert;
def squeezeDots6 = TTM_Squeeze(price6, length, nK, nBB, alertLine).SqueezeAlert;



def Top_Plot = (squeezeDots1 + squeezeDots2 + squeezeDots3 + squeezeDots4 +  squeezeDots5 +squeezeDots6) >= Vote;

plot MTF_Sqz = 7;
MTF_Sqz.SetPaintingStrategy(PaintingStrategy.POINTS);
MTF_Sqz.AssignValueColor(if Top_Plot == 1 then Color.BLACK else Color.DARK_RED);
MTF_Sqz.SetLineWeight(5);

plot Sqeezy1 = if squeezeDots1 == 1 then squeezeDots1 + 5 else 6;
plot Sqeezy2 = if squeezeDots2 == 1 then squeezeDots2 + 4 else 5;
plot Sqeezy3 = if squeezeDots3 == 1 then squeezeDots3 + 3 else 4;
plot Sqeezy4 = if squeezeDots4 == 1 then squeezeDots4 + 2 else 3;
plot Sqeezy5 = if squeezeDots5 == 1 then squeezeDots5 + 1 else 2;
plot Sqeezy6 = if squeezeDots6 == 1 then squeezeDots6 else 1;

Sqeezy1.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy1.AssignValueColor(if squeezeDots1 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy1.SetLineWeight(3);
Sqeezy2.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy2.AssignValueColor(if squeezeDots2 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy2.SetLineWeight(3);
Sqeezy3.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy3.AssignValueColor(if squeezeDots3 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy3.SetLineWeight(3);
Sqeezy4.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy4.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy4.SetLineWeight(3);
Sqeezy5.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy5.AssignValueColor(if squeezeDots5 == 1 then Color.DARK_GREEN else Color.DARK_RED);
Sqeezy5.SetLineWeight(3);
Sqeezy6.SetPaintingStrategy(PaintingStrategy.POINTS);
Sqeezy6.AssignValueColor(if squeezeDots6 == 1 then Color.DARK_GREEN else  Color.DARK_RED);
Sqeezy6.SetLineWeight(3);
do you or anyone know how to create a scan that when the dot on line 5 changes color (red to green and vice versa)?
 
M

maverick0987

New member
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:
subharmonic

subharmonic

New member
VIP
@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.
 
Pelonsax

Pelonsax

Active member
VIP
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:



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.



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!!!!!!!
 
Pelonsax

Pelonsax

Active member
VIP
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
 
Pelonsax

Pelonsax

Active member
VIP
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.
 
P

Pat007

New member
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..!!
 
T

trouble56

New member
VIP
@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();
 
T

trouble56

New member
VIP
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.
 
B

Brotank77

New member

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.
 

Similar threads

Top