TTM Squeeze Format, Scan, Watchlist, Label For ThinkOrSwim

Thanks to all coders here! I use the standard TOS TTM_Squeeze for the charts and wtf_dude's scan from page #2 - I use it on daily only. It works perfectly for me.

Is there a way to filter only results after 8 or more red dots? (something John Carter suggested)

Like this one i.e.:
1690874959059.png


Sorry if I overlooked it here.

Update: Well, I did manage to have 8 red dots in a row and a green one at the end. Can actually do with the condition wizard.
1690896345163.png


Code:
TTM_Squeeze()."SqueezeAlert" from 1 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 2 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 3 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 4 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 5 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 6 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 7 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 8 bars ago is false and
TTM_Squeeze()."SqueezeAlert" is true
 
Last edited:

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

Thanks to all coders here! I use the standard TOS TTM_Squeeze for the charts and wtf_dude's scan from page #2 - I use it on daily only. It works perfectly for me.

Is there a way to filter only results after 8 or more red dots? (something John Carter suggested)

Like this one i.e.:


Sorry if I overlooked it here.

Update: Well, I did manage to have 8 red dots in a row and a green one at the end. Can actually do with the condition wizard.


Code:
TTM_Squeeze()."SqueezeAlert" from 1 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 2 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 3 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 4 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 5 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 6 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 7 bars ago is false and
TTM_Squeeze()."SqueezeAlert" from 8 bars ago is false and
TTM_Squeeze()."SqueezeAlert" is true
I am interested to know how this scan has worked out for you since your post. Any changes or improvements? Have you looked into the Squeeze Pro setup with the extra colors/status?
 
For those of you who enjoy using the TTM Squeeze & Momentum indicator, this should be a handy addition to your ThinkorSwim chart setup. The script will add the status of the TTM Squeeze for stocks on your watchlist via a new column. You can select whichever timeframe you would like to scan for TTM squeeze.

Stocks usually break out of consolidations and by having the TTM Squeeze on your watchlist it helps to alert when they do.

Here is what each signal and labels represent:
  • Bright Red: The stock is in Buy zone
  • Dark Red: Market compression is currently in this time period. The number reveals the amount of dots on your TTM Squeeze indicator.
  • Dark Green: The squeeze has fired. The number notes how many dots (up to 5) and whether the squeeze signaled Long or Short.
  • Black: No squeeze on this time frame

View attachment 4687

thinkScript Code

Code:
# Squeeze watchlist column
#   Red Background   - Squeeze is building in the time period - number indicates how many dots
#      w/ white "B"  - Squeeze is building, stock is within "buy zone"
#   Green Background - Squeeze has fired - number indicates how many dots (up to 5 dots)
#                      and whether Squeeze fired L(ong) or S(hort)
#   Black Background - No Squeeze in play

# Original code by Eric Purdy of Simpler Trading 2017
# Modified code by Rich Stratmann to put in background colors and shorten column values
# Updates by dmccuskey
#   - change background colors to aid content scanning
#   - add "B" to time frames which are in the Buy Zone - between 8 & 21 EMA
#   - change "0" to " " <space> so that the content doesn't show when row is highlighted

#ToS Share Code: https://tos.mx/IPrEhH

def sqz = !TTM_Squeeze().SqueezeAlert;
def direction = TTM_Squeeze()>TTM_Squeeze()[1];
def count = if sqz and !sqz[1] then 1 else count[1]+1;
def isFired = if !sqz and sqz[1] then 1 else 0;
def firedCount = if isFired then 1 else firedCount[1]+1;
def firedDirection = if isFired then direction else firedDirection[1];

def sumIsFired = sum(isFired,5);
def isFiredDir = sumIsFired && firedDirection;

# look for close buy zone
def ema8 = reference movAvgExponential(length=8);
def ema21 = reference movAvgExponential(length=21);
def currPrice = close();
def highVal = Max(ema8, ema21);
def lowVal = Min(ema8, ema21);
def inBuyZone = currPrice >= lowVal && currPrice <= highVal;

def sqzBuy = sqz && inBuyZone;
def sqzNoBuy = sqz && !inBuyZone;

addLabel(yes, Concat(if sqzBuy then "B " else "", if sqz then "" + count else if sumIsFired then “” + firedCount + if firedDirection then ” L” else ” S” else “ ”), if sqzBuy then color.white else color.black);

AssignBackgroundColor(if sqzNoBuy then  CreateColor(170, 6, 0) else if sqzBuy then color.red else if sumIsFired then CreateColor(28, 105, 3) else color.black);

Shareable Link

https://tos.mx/uXplYi

Credits:
How can I use this in a scan? I want to scan for tickers that have at least 3 red dots.
 
I would like to have a watchlist column for the Sqz Pro Alert, so i can monitor when the sqz has fired, can u help me with the code, i'm unable to get it to work. Thanks

def sqz = !TTM_SqueezePro().SqueezeAlert;
def direction = ST_SqueezePro()>ST_SqueezePro()[1];
def count = if sqz and !sqz[1] then 1 else count[1]+1;
def fired = if !sqz and sqz[1] then 1 else 0;
def firedCount = if fired then 1 else firedCount[1]+1;
def firedDirection = if fired then direction else firedDirection[1];
addLabel(yes, if sqz then “Squeeze:” + count else if sum(fired,5) then “Fired:” + firedCOunt + if firedDirection then ” Long” else ” Short” else “-”, if sqz then color.red else if sum(fired,5) and firedDirection then color.green else color.orange);
 
Hello all, I'm looking for a ttm squeeze histogram turns up or down signal where it labels an arrow sign up or down on a chart. Please point me to the direction.

Thanks in advance
 
Hello All,

Here's a snippet of a label code that im having trouble with. I'd like for the label color to change as the squeeze condition, Thanks in advance

AddLabel(yes, if ExtrSqueeze then "ExtrSqueeze" else if originalSqueeze then "originalSqueeze" else if presqueeze then "presqueeze" else "NO SQUEEZE");

def sq_color = if ExtrSqueeze then 3 else
if originalSqueeze then 2 else
if presqueeze then 1 else 0;
#if sq_color == ExtrSqueeze then (Color,RED);
#if sq_color == originalSqueeze then (Color,DARK_ORANGE);
#if sq_color == presqueeze then (Color,YELLOW) else 0;
 
Have been having limited success lately with my squeeze efforts. I believe the black dot squeezes have not afforded the best results. Does anyone have any suggestions or a scanner that will filter out all but bullish red & orange dot stocks?
 
I was also looking for code that changes the label of the squeeze condition (yellow for low compression, red for mid squeeze and magenta for high compression squeezes).
 
Oh no, you have to put it with the code I posted earlier. Just create a new study, call it something like AdvancedSqueezeScanner and paste all of this and then use it on the scan tab. Should be go to go.

Code:
# AdvancedSqueezeScanner
# Momentum Squeeze open coding by Moebius, based on John Carter
# Scan by WTF_Dude
# Added Squeeze Label with directional color
# Label is green when momentum is ascending, red when descending

declare lower;

input length = 20; #hint length: Length for average calculation
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;

   def K = (Highest(High, length) + Lowest(low, length)) /
               2 + ExpAverage(close, length);
  def Momo = Inertia(price - K / 2, length);

def SD = StDev(close, length);
def Avg = Average(close, length);
def ATR = Average(TrueRange(high, close, low), length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);

def Squeeze = SDup < ATRup;
       
def zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;

def momobullup = Momo > Momo[1] and Momo > 0;
def momobulldown = Momo > 0 and Momo < Momo[1];
def momobeardown =  Momo > Momo[1] and Momo > 0;
def momobearup = Momo < 0 and Momo > Momo[1];



Plot BreakoutEitherDirection = squeeze[1] is true and squeeze is false;
plot BreakoutBull = squeeze[1] is true and squeeze is false and momobullup;
plot BreakoutBear = squeeze[1] is true and squeeze is false and momobulldown;

Plot BullTrendReversal = momobulldown is true and momobulldown[1] is false;
Plot BearTrendReversal = momobearup is true and momobearup[1] is false;

plot Squeeze_ChangetoBull = BearTrendReversal and squeeze is true;
plot Squeeze_ChangetoBear = BullTrendReversal and squeeze is true;

#End Code
hi @wtf_dude ! i love your shares. Is there any way to make these into labels for the chart? interested in the histo flip pos/neg, the histo shift from red/yellow and teal/royalblue, and last and best... the dots!!!!
 
I'm looking for a scanner that will find tickers in the TTM Squeeze at the first yellow bar.

Try this in the scanner
Screenshot 2024-02-28 102154.png
Screenshot 2024-02-28 102219.png
Code:
def ttm_histogram = TTM_Squeeze();
def red_squeeze   = if ttm_histogram < 0 and ttm_histogram < ttm_histogram[1] then 1 else 0;
plot first_yellow = if red_squeeze[1] == 1 and !red_squeeze and ttm_histogram < 0 then 1 else 0;
AddChartBubble(first_yellow, 0, first_yellow, Color.YELLOW);

#
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
455 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