I just found this script online. I'm not sure if it is already shared.
Trading Software: thinkorswim
Based on: TTM Squeeze (Bollinger Bands & Keltner Channels), Elliot Waves, & ParobolicSAR
Description: This study strives to emulate and optimize the TTM Squeeze study. The red squeeze indicator fires when the symbol’s Bollinger Bands are inside the symbol’s Keltner Channel. The green and red arrows are Parabolic SAR crossover indicators. The green/red waves are Wave A of the Elliot Waves, and the yellow/blue waves are Wave C of the Elliot Waves. The chart label outlines the squeeze resolution in an attempt to predict the breakout direction of the squeeze.
Optimal Long Sequence:
Histogram shift from light red to dark red with values increasing toward the index line, confirming a shift from distribution to accumulation.
Red Squeeze indicators firing indicating consolidation; Bollinger Band compression and volatility increase.
A green up arrow indicating the Parabolic Stop and Reverse has made a bullish crossover.
Optimal Short Sequence is the reverse of the above (histogram from dark green to light green, red squeeze indicators firing, and red arrow for bearish Parabolic SAR crossover).
@cswu1211 This is the part of the script that plots the Red Squeezed BBS_Ind is the element. This part of the script states BBS_Ind plots size 3 red squares if isSqueezed.
I have Mobius Squeeze code here that I would like to use only the squeeze part as you can see, I take away already everything else. Now I want to hide the green point (the not squeeze part) and leave only the high, middle and low squeeze points. can some show me how to done that?
I have Mobius Squeeze code here that I would like to use only the squeeze part as you can see, I take away already everything else. Now I want to hide the green point (the not squeeze part) and leave only the high, middle and low squeeze points. can some show me how to done that?
yes exactly that. can you help me with a label because the one I create count me wrong. I want to have a label that tell me how many squeeze is happening?
yes exactly that. can you help me with a label because the one I create count me wrong. I want to have a label that tell me how many squeeze is happening?
Try this.
Some of the squeezes overlap so you will get overlapping colors and more than one squeeze will a count.
You can uncomment the portion of the count labels if you only want the label to show if there is a count for a particular squeeze.
Try this.
Some of the squeezes overlap so you will get overlapping colors and more than one squeeze will a count.
You can uncomment the portion of the count labels if you only want the label to show if there is a count for a particular squeeze.
Try this.
Some of the squeezes overlap so you will get overlapping colors and more than one squeeze will a count.
You can uncomment the portion of the count labels if you only want the label to show if there is a count for a particular squeeze.
As a last question, I have another calculation code. I just finishing to put a signal indicator together and with this I think I can make a start on my indicator. I got some level signals that I make them manually and my code become to long in my opinion, I think it could be more simple.
my level signal point start at 1.8 and I want every time increase 0.5 shows me again another point signal and again for every time it keep increasing 0.5
here is the code I got for now for that part
Code:
def obL1 = 1.8;
def obL2 = 2.3;
def obL3 = 2.8;
def obL4 = 3.3;
plot mSig = if !IsNaN(close) then flen else Double.NaN;
mSig.SetDefaultColor(Color.MAGENTA);
mSig.SetLineWeight(2);
plot exUp1 = if mSig crosses above obL1 then mSig else Double.NaN;
exUp1.SetPaintingStrategy(PaintingStrategy.POINTS);
exUp1.SetDefaultColor(Color.yellow;
exUp1.SetLineWeight(5);
plot exDn1 = if mSig crosses below -obL1 then mSig else Double.NaN;
exDn1.SetPaintingStrategy(PaintingStrategy.POINTS);
exDn1.SetDefaultColor(Color.yellow;
exDn1.SetLineWeight(5);
As a last question, I have another calculation code. I just finishing to put a signal indicator together and with this I think I can make a start on my indicator. I got some level signals that I make them manually and my code become to long in my opinion, I think it could be more simple.
my level signal point start at 1.8 and I want every time increase 0.5 shows me again another point signal and again for every time it keep increasing 0.5
here is the code I got for now for that part
Code:
def obL1 = 1.8;
def obL2 = 2.3;
def obL3 = 2.8;
def obL4 = 3.3;
plot mSig = if !IsNaN(close) then flen else Double.NaN;
mSig.SetDefaultColor(Color.MAGENTA);
mSig.SetLineWeight(2);
plot exUp1 = if mSig crosses above obL1 then mSig else Double.NaN;
exUp1.SetPaintingStrategy(PaintingStrategy.POINTS);
exUp1.SetDefaultColor(Color.yellow;
exUp1.SetLineWeight(5);
plot exDn1 = if mSig crosses below -obL1 then mSig else Double.NaN;
exDn1.SetPaintingStrategy(PaintingStrategy.POINTS);
exDn1.SetDefaultColor(Color.yellow;
exDn1.SetLineWeight(5);
you are totally right! Well I got 8 times that type of signal that of course with your idea I did resume the amount of code even more as you can see here. but what I was thinking if I can create a calculation that after the signal gets to obL1 and keep increasing and reach extra 0.5 more the signal fire another Point and so on? if you see my level increases every 0.5
you are totally right! Well I got 8 times that type of signal that of course with your idea I can resume the amount of code to half.
but what I was thinking if I can create a calculation that after the signal gets to obL1 and keep increasing and reach extra 0.5 more the signal fire another Point and so on?
Here is something that you might help. I used an example of AAL and price as I do not know enough about your code's obL's.
Ruby:
defcond=if close crosses above 17then1elseif cond[1]==1and close crosses above 17.50then1elseif cond[1]==1and close crosses above 18then1else0;
plot data = cond;
data.setpaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
plot ext1 = if mSig crosses above obL1 or mSig crosses below -obL1 then mSig else
if mSig crosses above obL2 or mSig crosses below -obL2 then mSig else
if mSig crosses above obL3 or mSig crosses below -obL3 then mSig else
if mSig crosses above obL4 or mSig crosses below -obL4 then mSig else Double.NaN;
ext1.SetPaintingStrategy(PaintingStrategy.POINTS);
ext1.SetDefaultColor(CreateColor(255,255,0));
but I will see what I can do with your code but I will be hard on me since I'm no to expirience in thinkscript, but I will try by the way my idea is for lower indicator
This is a Mobius script. It is the bottom indicator in my screenshot
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.Blue
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
This is a Mobius script. It is the bottom indicator in my screenshot
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.Blue
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
@Mattyb740
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @justAnotherTrader has not been seen in a while.
@chincha
No, there is no volume data involved in calculating a squeeze. "The Squeeze" is a term for when price movement is in consolidation, So no there is no volume label in the squeeze script.
# Momentum Squeeze V02# Mobius# V02.04.01.2020# New faster Momentum Oscillator with outer band markers. New more accurate Squeeze indication.
declare lower;
input n =20;defc= close;defmean=Inertia(c, n);defSD=Sqrt((fold i =0 to n
with s
do s +Sqr(mean -GetValue(c, i)))/ n);
plot Momo=Inertia((c - mean)/SD,Floor(n ));Momo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);Momo.assignValueColor(ifMomo>Momo[1]andMomo>0thenColor.CyanelseifMomo>0andMomo<Momo[1]thenColor.BlueelseifMomo<0andMomo<Momo[1]thenColor.dark_Red
elseColor.Yellow);defupper= mean +(2*SD);deflower= mean -(2*SD);defW=(upper - lower)/ mean;defB=Highest(W, n *2);defSq=Lowest(W, n *2);
plot Squeeze=if((W-Sq)/(B-Sq))<=.01then0elseDouble.NaN;Squeeze.SetStyle(Curve.POINTS);Squeeze.SetLineWeight(3);Squeeze.SetDefaultColor(Color.YELLOW);AddLabel(Squeeze,"Squeeze",Color.YELLOW);
plot "0"=if!IsNaN(Squeeze)orIsNaN(c)thenDouble.NaNelse0;"0".SetStyle(Curve.Points);"0".SetDefaultColor(Color.GRAY);
plot "1"=ifIsNaN(c)thenDouble.NaNelse1;"1".SetDefaultColor(Color.GREEN);
plot "-1"=ifIsNaN(c)thenDouble.NaNelse-1;"-1".SetDefaultColor(Color.dark_RED);# End Code V02 Momentum Squeeze
@Jonas99 shared this on Discord. He provided this image with the comparison of the indicator which is the one on the very bottom.
Newer Code: My guesses of old code (some obvious):
input n = 20; length
def c = close; price
def mean = Inertia(c, n); Avg
def SD = Sqrt((fold i = 0 to n SD
with s
do s + Sqr(mean - GetValue(c, i))) / n);
def upper = mean + (2 * SD); ? SDup with SdMult = 2
def lower = mean - (2 * SD); ? SDlow - not in original code
def W = (upper - lower) / mean;
def B = Highest(W, n * 2); ? ATRup with ATRmult = 2 (if so why change from 1.5 to 2)
def Sq = Lowest(W, n * 2); ? ATRlow - not in orginal
plot Squeeze = if ((W - Sq) / (B - Sq)) <= .01 ? Why now less than 0.1 vs if SDup < ATRup
? why no K
? if any '?' are wrong, what are they and how do they map, and why the change?
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.
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.