Squeeze Play Strategy For ThinkOrSwim

The trend file that I found on here. It shows up on the price action. I’ve added so many and been testing them that im not sure about the correct tos file. But the name that came up when I originally typed it in is trend scan and it will have arrows showing if candles are going up or down.
-I see that you added to your study and I’ll be honest that looks very intimidating for someone like me.
The name is trend reversal. Read more about the Trend Reversal Study here:
https://usethinkscript.com/threads/trend-reversal-questions.7600/
 

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

I was just asking if all 3 green label indicators come up on say a 30 min chart but not the 1,5,15,1hr,4hr,daily or weekly, would that suggest that the stock would move up only for a brief time and it be intraday ?
If I happened to see the labels on the daily -which I haven’t yet, I would think that the security is ready for the Ttm squeeze any moment and would be ok in holding overnight.
But I don’t have much experience in this indicator and was asking. Thank you.
 
Last edited by a moderator:
I was just asking if all 3 green label indicators come up on say a 30 min chart but not the 1,5,15,1hr,4hr,daily or weekly, would that suggest that the stock would move up only for a brief time and it be intraday ?
If I happened to see the labels on the daily -which I haven’t yet, I would think that the security is ready for the Ttm squeeze any moment and would be ok in holding overnight.
But I don’t have much experience in this indicator and was asking. Thank you.
I don't trade repainting indicators. But your idea is interesting. If all the lower aggregations labels are green, does that lessen the chance of a false signal on the aggregation you are trading? Does it mean that the stock is going to continue higher?

To find the answer, add it to your chart. Analyze it over different timeframes, across history and with multiple instruments. I would look for green on the lower timeframes (nothing lower than 5min, too much noise, too much repainting), a dip in the middle aggregations AND green on a monthly timeframe (a strong long-term uptrend could tip the scales toward an upward push).
Obviously no indicator should be traded in isolation.

Come back and share your findings!
 
Last edited:
I added a Lower Study that shows all of the criteria including the Squeeze Play. The study plots 5 lines.
  • The 1st Line with a space under it is the overall Squeeze Play. Green Dots = Bull, Red Dots = Bear and Yellow Dots = No Play.
  • The 2nd Line is the TTM Squeeze. Green Dots = Squeeze and Yellow Dots = No Squeeze.
  • The 3rd Line is the Stacked EMAs. Green Dots = EMAs Stacked Upward (Bullish) and Red Dots = EMAs Stacked Downward (Bearish) and the Yellow Dots = No EMAs Stacked.
  • The 4th Line is the TTM Momentum (MO). Green Dots = Bullish MO and Red Dots = Bearish MO and Yellow Dots = No MO.
  • The 5th Line is the Close Over/Under 21. Green Dots = Close Over 21 and Red Dots = Close Under 21
I like this for back testing and analyzing trades and setups. Please let me know your thoughts.
View attachment 1150
Here is the code:
Ruby:
#Squeeze Play Strategy For ThinkOrSwim
#@Gavstah 10/2021
#@InvestingtoGive added Lower Level 11/4/2021
#Hint: SqueezePlay - stacked EMAs (8,21,34,55,89), Upward momentum on TTM_Squeeze, in a squeeze, and price over the 21 EMA

declare lower;

input price = close;

# define the EMAs
def ema8 = ExpAverage(price, 8);
def ema21 = ExpAverage(price, 21);
def ema34 = ExpAverage(price, 34);
def ema55 = ExpAverage(price, 55);
def ema89 = ExpAverage(price, 89);

# define the EMAs
def EMA8_ = ExpAverage(price, 8);
def EMA21_ = ExpAverage(price, 21);
def EMA34_ = ExpAverage (price, 34);
def EMA55_ = ExpAverage (price, 55);
def EMA89_ = ExpAverage (price, 89);

# is the price in the buy zone?
def buyZone = price < ema8 and price > ema21;
def sellZone = price > ema8 and price < ema21;
# now, let's see what we have

# 1) is momentum > 0 and on an upward trend on then TTM_Squeeze() histogram?
def bullMomentum = TTM_Squeeze().Histogram > 0 && TTM_Squeeze().Histogram > TTM_Squeeze().Histogram[1];
def bearMomentum = TTM_Squeeze().Histogram < 0 && TTM_Squeeze().Histogram < TTM_Squeeze().Histogram[1];
# 2) Has the price closed over the 21 EMA?
def bullcloseOver21 = price > EMA21_;
def bearcloseOver21 = price < EMA21_;

# 3) Are EMAs stacked in acsending order ("The Royal Setup")?
def bullstackedEMAS = EMA8_ > EMA21_ and EMA21_ > EMA34_ and ema34 > EMA55_ and EMA55_ > ema89;
def bearstackedEMAS = EMA8_ < EMA21_ and EMA21_ < EMA34_ and ema34 < EMA55_ and EMA55_ < ema89;

# 4) are we in a TTM_squeeze (true if squeezealert has not fired)?
def squeeze = !TTM_Squeeze().SqueezeAlert;

# do we have a squeeze play?
def bullsqueezePlay = squeeze && bullstackedEMAS && bullMomentum && bullcloseOver21;
def bearsqueezePlay = squeeze && bearstackedEMAS && bearMomentum && bearcloseOver21;

# Plot for Squeeze Play
plot Dots_Play_Color = if ( isnaN(close),double.NaN, 6);
Dots_Play_Color.SetPaintingStrategy(PaintingStrategy.POINTS);
Dots_Play_Color.AssignValueColor( if (bullsqueezeplay) then Color.GREEN else if (bearsqueezeplay) then Color.RED else Color.Yellow);
Dots_Play_Color.SetLineWeight(5);

# Plot for TTM Squeeze
plot Dots_Squeeze_Color = if ( isnaN(close),double.NaN, 4);
Dots_Squeeze_Color.SetPaintingStrategy(PaintingStrategy.POINTS);
Dots_Squeeze_Color.AssignValueColor( if (squeeze) then Color.GREEN else Color.Yellow);
Dots_Squeeze_Color.SetLineWeight(5);

# Plot for Stacked EMAs
plot Dots_EMAS_Color = if ( isnaN(close),double.NaN, 3);
Dots_EMAS_Color.SetPaintingStrategy(PaintingStrategy.POINTS);
Dots_EMAS_Color.AssignValueColor( if (bullstackedEMAS) then Color.GREEN else if (bearstackedEMAS) then Color.RED else Color.Yellow);
Dots_EMAS_Color.SetLineWeight(5);

# Plot for Momentum (MO)
plot Dots_MO_Color = if ( isnaN(close),double.NaN, 2);
Dots_MO_Color.SetPaintingStrategy(PaintingStrategy.POINTS);
Dots_MO_Color.AssignValueColor( if (bullMomentum) then Color.GREEN else if (bearMomentum) then Color.RED else Color.Yellow);
Dots_MO_Color.SetLineWeight(5);

# Plot for Cross Over/Under 21
plot Dots_Cross_Color = if ( isnaN(close),double.NaN, 1);
Dots_Cross_Color.SetPaintingStrategy(PaintingStrategy.POINTS);
Dots_Cross_Color.AssignValueColor( if (bullcloseOver21) then Color.GREEN else if (bearcloseOver21) then Color.RED else Color.Yellow);
Dots_Cross_Color.SetLineWeight(5);

This block of code is redundant and can be removed.

# define the EMAs
def ema8 = ExpAverage(price, 8);
def ema21 = ExpAverage(price, 21);
def ema34 = ExpAverage(price, 34);
def ema55 = ExpAverage(price, 55);
def ema89 = ExpAverage(price, 89);

# Change this:
# 3) Are EMAs stacked in acsending order ("The Royal Setup")?
def bullstackedEMAS = EMA8_ > EMA21_ and EMA21_ > EMA34_ and ema34 > EMA55_ and EMA55_ > ema89;
def bearstackedEMAS = EMA8_ < EMA21_ and EMA21_ < EMA34_ and ema34 < EMA55_ and EMA55_ < ema89;

# To this:
# 3) Are EMAs stacked in acsending order ("The Royal Setup")?
def bullstackedEMAS = EMA8_ > EMA21_ and EMA21_ > EMA34_ and ema34 > EMA55_ and EMA55_ > EMA89;
def bearstackedEMAS = EMA8_ < EMA21_ and EMA21_ < EMA34_ and ema34 < EMA55_ and EMA55_ < EMA89;
 
Taylor also uses ATR as is target points. -1, -2, and -3 ATRs and 1, 2, and 3 ATRs. Not good at coding, but can this indicator include this?
 
Hi. Sorry that I wasn’t clear. Taylor Horton uses the Keltner Channels factorfor profit targets and exit targets ort targets. So three studies of the keltner channels with a factor of 1, 2, and 3. If the price of the stock closes between the upper and lower bands of the factor 1 keltner channels, he considers this the buy zone. Then he uses factor of 2 or 3 as his price targets.

Can the code be updated to have the buy zone between the upper and lower band of the factor of 1 keltner channels?
 
Squeeze Play Strategy For ThinkOrSwim
Hi All -

My first attempt at Thinkscript - feedback very much welcomed. This very basic indicator is based on four criteria laid out by Tylor Horton of Focused Trades (now with Simpler Trading folks) that he uses for his method of trading squeeze setups. This provides a bright green label that will show up on the top of the chart when the ticker has met the following conditions:

1) is momentum > 0 and on an upward trend on the TTM_Squeeze() histogram?
2) Has the price closed over the 21 EMA?
3) Are EMAs (8,21,34,55 and 89) stacked in acsending order ("The Royal Setup")?
4) Is this ticker in a TTM_squeeze (true if squeezealert has not fired)?

Code:
#Squeeze Play Strategy For ThinkOrSwim
#@Gavstah 10/2021
#Hint: SqueezePlay - stacked EMAs (8,21,34,55,89), Upward momentum on TTM_Squeeze, in a squeeze, and price over the 21 EMA

input price = close;

# define the EMAs
def ema8  = ExpAverage(price, 8);
def ema21 = ExpAverage(price, 21);
def ema34 = ExpAverage(price, 34);
def ema55 = ExpAverage(price, 55);
def ema89 = ExpAverage(price, 89);

# plot the EMAs
plot EMA8_ = ExpAverage(price, 8);
plot EMA21_ = ExpAverage(price, 21);
plot EMA34_ = ExpAverage (price, 34);
plot EMA55_ = ExpAverage (price, 55);
plot EMA89_ = ExpAverage (price, 89);

# is the price in the buy zone?
def buyZone = price < EMA8 AND price > EMA21;

# now, let's see what we have

# 1) is momentum > 0 and on an upward trend on then TTM_Squeeze() histogram?
def bullMomentum = TTM_Squeeze().Histogram > 0 && TTM_Squeeze().Histogram > TTM_Squeeze().Histogram[1];

# 2) Has the price closed over the 21 EMA?
def closeOver21 = price > EMA21_;

# 3) Are EMAs stacked in acsending order ("The Royal Setup")?
def stackedEMAS =  EMA8_ > EMA21_ AND EMA21_ > EMA34_ AND EMA34 > EMA55_ AND EMA55_ > EMA89;

# 4) are we in a TTM_squeeze (true if squeezealert has not fired)?
def squeeze = !TTM_Squeeze().SqueezeAlert;

# do we have a squeeze play?
def squeezePlay = squeeze && stackedEMAS && bullMomentum && closeOver21;

# set the stacked label
AddLabel(price, ”Stacked EMAs” , (if stackedEMAS then Color.GREEN else Color.RED));

# set Squeeze Play label if we're in a squeeze play.
AddLabel(if squeezePlay then yes else no, " Squeeze Play ", Color.GREEN);

# Add buy zone label if we're in the buy zone
AddLabel(if buyZone then yes else no, "BUY ZONE", Color.GREEN);

TS can be access here: http://tos.mx/0fhkJir
Also available as a Github Gist
Is there a way to add this indicator but not have all the MAs plotted on your chart so I can just add the ones of my choosing outside of this script? Much appreciated!
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
438 Online
Create Post

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