TTM Squeeze Format, Scan, Watchlist, Label For ThinkOrSwim

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

The trading day consists of 6.5 hours or 390 minutes... Half of 390 is 195 and 1/3 of 390 is 130... The numbers 78 and 39 are also players... 💡
Correct I totally agree, I use the 195 and 130 heavily for selling put spreads based on the daily chart setup.
 
@pk1729 do you know what the code would be to create a scan to show when there are the first 3 consecutive red bars? Looking a little earlier. Any help is greatly appreciated!
 
@pk1729 do you know what the code would be to create a scan to show when there are the first 3 consecutive red bars? Looking a little earlier. Any help is greatly appreciated!
In reality you don't look for red bars, you look for bars that close lower than previous bars... Color is moot... Something like the following is the logic to check for three lower closing bars...

Ruby:
def threeDown = close < close[1] and close[1] < close[2] and close[2] < close[3];
 
Guys, will you please help me? I need to filter the stocks that are in squeeze for 3 or more bars. what do I need to tweak in below script?

Code:
TTM_Squeeze()."SqueezeAlert" [1] is false and
TTM_Squeeze()."SqueezeAlert" [2] is false and
TTM_Squeeze()."SqueezeAlert" [3] is false

i am looking for stocks that are in the squeeze for more than 3 days.
 
Last edited by a moderator:
i am looking for stocks that are in the squeeze for more than 3 days.
The code you posted is all you need for that scan. The line with [1] looks at yesterday, [2] looks at the day before, etc. That code does not look at the current day, only yesterday and two days previous. You can add more days with higher numbers in the brackets. To look at today you can put zero in the brackets [0].
 
Thanks a lot for the quick response. Is it possible to get yellow first bar scan and blue bar

The one I posted is crossing from negative to positive, going from yellow to cyan (light blue). For the opposite scan, from dark blue to red, just change where it says "crosses above" and make it "crosses below".
 
@gravity2726 The following code should work but you may want to add additional filters... There may be better ways to do this and I'll see what else I can come up with...

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] > 0 and hist[2] < 0 then 1 else Double.NaN;
 
Last edited:
Hello Mates,

After the earning as shown in the image, I want to catch the first 2 blue bars after the red/ squeeze.


For example $CNMD had earning on 27th Jan followed by dark blue bars and red squeeze , I don't want to catch the blue bars after the earnings but I want to catch light blue bars after the squeeze (on feb 12th).

I am looking to scan for the stocks with this pattern
 
Last edited by a moderator:
So you are looking for the green dot, correct...??? What version of TTM_Squeeze are you using...??? I'm going to give you the code you need based on the "A version of the Squeeze Pro" located here in the forums at
https://usethinkscript.com/threads/...s-pro-squeeze-for-thinkorswim.4021/post-44351 because the standard TTM_Squeeze code is licensed and therefore we don't have access to the underlying source...

Ruby:
plot squeeze = if s0 or s1 or s2 or s3 then 0 else double.nan;
     squeeze.SetLineWeight(3);
     squeeze.SetStyle(curve.POINTS);
     squeeze.AssignValueColor(if s1 then color.orange
                              else if s2 then color.red
                              else if s3 then color.yellow
                              else color.green);

If you look at the code above you will notice that there is no way to determine the green dot other than in the first line of the snippet... The way to find the green dot is by using "squeeze == s0" ... Make sure you understand that logic... Therefore, if your code above is correct it should read like the following in order to include the green dot...

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] > 0 and hist[2] < 0 and squeeze == s0 then 1 else Double.NaN;

That last part was a bit tricky which is why I went ahead and described it and added it into your code..
 
Last edited by a moderator:
is it possible to alter this instead of looking for the stock exiting the squeeze, instead they are still in the squeeze?


I'm looking for a little help on a scanner (hopefully simple) that will identify when the squeeze has now become cyan or at least a variable threshold I can set that will trigger the alert.

Could anyone please assist in this?

Thanks for your help!
 
Last edited by a moderator:
Good day everyone.

I'm looking for a little help on a scanner (hopefully simple) that will identify when the squeeze has now become cyan or at least a variable threshold I can set that will trigger the alert.

Could anyone please assist in this?

Thanks for your help!

I posted in the Discord channel but will also post here... Brace yourself, it's a whopper...!!!

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] > 0 and hist[2] < 0 then 1 else Double.NaN;

This code will find the second cyan histogram bar... The code can easily be modified to find the first cyan bar as shown below...

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] < 0 and hist[2] < hist[1] then 1 else Double.NaN;
 
I posted in the Discord channel but will also post here... Brace yourself, it's a whopper...!!!

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] > 0 and hist[2] < 0 then 1 else Double.NaN;

This code will find the second cyan histogram bar... The code can easily be modified to find the first cyan bar as shown below...

Ruby:
def hist = reference TTM_Squeeze.Histogram;
plot scan = if hist > 0 and hist[1] < 0 and hist[2] < hist[1] then 1 else Double.NaN;
Do you know if it’s possible to calculate The gain/difference between ; for example. Cyan 2 bars alone compared to cyan 1 bar ago
 
Code:
plot difference = cyan[1]-cyan;

plot means showe me
difference is the variable that we named "difference" but you can call it whatever
cyan[1] means cyan from 1 bar ago
- means minus
cyan means current cyan bar
 
How can I calculate whether bar[1] is 5% > than bar[2] ?
using the histogram? ive been able to figure simple stuff out but this math stuff seems out of my range for now. any help is much appreciated
 
How can I calculate whether bar[1] is 5% > than bar[2] ?
using the histogram? ive been able to figure simple stuff out but this math stuff seems out of my range for now. any help is much appreciated

Simple math... That would be ((bar - bar[1]) / bar[1]) >= .05 or whatever method you choose to come up with an answer... Another method would be bar >= bar[1] x 1.05... Simply use correct indexing of bars to suit your needs... And use close instead of bar...
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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