TTM Squeeze Format, Scan, Watchlist, Label For ThinkOrSwim

Added ATRplus for the two options that indicate the move is bigger than the ATR.
@Sagar these options might work better for you as well

@wtf_dude Somehow ATRplus is not triggering working for me that well.. Tested it almost a week and only triggered once on 10m for one symbol.. Nothing on other hours for any of the watchlist item. Can someone confirm if its working well for them. I changed move threshold from 50 to 25 also..
 
Added ATRplus for the two options that indicate the move is bigger than the ATR.
@Sagar these options might work better for you as well

@wtf_dude Somehow ATRplus is not triggering working for me that well.. Tested it almost a week and only triggered once on 10m for one symbol.. Nothing on other hours for any of the watchlist item. Can someone confirm if its working well for them. I changed move threshold from 50 to 25 also..
Cleaned the code a bit, but I think the logistics were ok. If you're using the ATR, then that's already your threshold. Go ahead and change the threshold entry to 0
Code:
# Advanced Squeeze Scanner v2.0
# Momentum Squeeze basis coding by Moebius, based on John Carter
# Scanner by WTF_Dude. Mods on 9.9.20
# Edited 9.22.20

declare lower;

input length = 20; #hint length: Length for average calculation
input price = close;
input SDmult = 2.0;
input ATR_mult = 1.5;
input ATR_length = 20;
input Move_Threshold = 0; #best to set to 0 if using ATR options


   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), ATR_length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (Atr_Mult * 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 > Move_Threshold and Momo>0;
def momobulldown = Momo > 0 and Momo < Momo[1];
def momobeardown =  Momo < Momo[1] and absvalue(Momo)>Move_Threshold and momo<0;
def momobearup = Momo < 0 and Momo > Momo[1];

def change = absvalue(close - close[1]);

# Squeeze breaks out in EITHER direction
Plot Breakout = squeeze[1] is true and squeeze is false;

# Breakout of squeeze to the upside
plot BreakoutBull = squeeze[1] is true and squeeze is false and momobullup;
# Breakout of squeeze to the downside
plot BreakoutBear = squeeze[1] is true and squeeze is false and momobulldown;

# Breakout of squeeze to the upside with move larger than ATR
plot BreakoutBullATRplus = squeeze[1] is true and squeeze is false and momobullup  and change>ATR;
# Breakout of squeeze to the downside with move larger than ATR
plot BreakoutBearATRplus = squeeze[1] is true and squeeze is false and momobeardown and change>ATR;

# Bull trend reverses and turns down while the color changes to dark blue
Plot BullTrendReversal = momobulldown is true and momobulldown[1] is false;
# Bear trend reverses and turns up while the color changes to yellow
Plot BearTrendReversal= momobearup is true and momobearup[1] is false;

# Zero line turns red and becomes a squeeze
plot EnteringSqueeze = Squeeze[1] is false and Squeeze is true;
 
Last edited:
Cleaned the code a bit, but I think the logistics were ok. If you're using the ATR, then that's already your threshold. Go ahead and change the threshold entry to 0
@wtf_dude
I will give a try this week for ATR option and will update the results here. Thanks for making everyone life easy. you are the best.
 
This is dumb, but i need help from someone here.

For some reason, I swear my squeeze indicator is reversed.

but, when i go to edit the indicator, it says alert red. normal green.

can anyone help me figure out if im crazy or not? :)

monday night. looks like $NAIL is on a daily squeeze. the middle ball is red.
 
Last edited by a moderator:
@vro3 Post a screenshot of your ToS. Here is my chart of $NAIL on the Daily timeframe.

NRe6igg.png
 
so - mine looks like that - but, in the edit studies - i have the two colors reverse. ill get you a screenshot in a bit!

UkXZZif.png


YgMwBeP.png


am i crazy? is this normal? shouldn't alert be red?
 
Last edited by a moderator:
Hi, @wtf_dude love the code work you are doing with ttm squeeze. Do you happen to have code handy for say 5 or more red bars that the energy has shifted for at least 2 yellow bars?
 
Hi, @wtf_dude love the code work you are doing with ttm squeeze. Do you happen to have code handy for say 5 or more red bars that the energy has shifted for at least 2 yellow bars?
you mean a downcycle where its been below 0 for at least 5 red bars, but has turned up and confirmed with 2 yellows coming up, correct?
 
@pk1729 Does anyone know how to create custom thinkscript when the TTM Squeeze dots turn from Red to Green?

I've tried to do this with the Conditional Wizard, but I can't figure it out and TOS Support said it's not possible through the condition wizard.

Please help! I've been trying to figure this out for 6 months!
 
you mean a downcycle where its been below 0 for at least 5 red bars, but has turned up and confirmed with 2 yellows coming up, correct?
That is correct, I sell a lot of put credit spreads. So I am looking for an early indicator that momentum is shifting from sell pressure to buy.
 
That is correct, I sell a lot of put credit spreads. So I am looking for an early indicator that momentum is shifting from sell pressure to buy.
Right on, this is absolutely NOT the best way to pull this off but I can't think for **** atm as I'm on like 3 hours sleep. This should work fine. Ive noticed sometimes it will print 3 bars up vs only 2 every now and then, but it will get you alot of candidates. Don't worry about the condition wizard. Just copy paste this into thinkscript editor and you're done.

Code:
# ChiefCarl custom request by WTF_Dude
# Momentum wave turns up for 2 bars and spending at least 5 bars descending

declare lower;

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



   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), ATR_length);

def momobearup = Momo < 0 and Momo > Momo[1] and momo[1]>momo[2] and momo[2]<momo[3];

def change = absvalue(close - close[1]);

input min_bars =7;
def minreq = momo[3]<momo[4] and momo[4]<momo[5] and momo[5]<momo[6] and momo[6]<momo[7] and momo[7]<momo[8] and highest(momo,7)<0;
def twobarprint = momo>momo[1] and momo[1]>momo[2] and momo[3]<momo[4];


Plot BearMinMomentum = minreq and twobarprint;
 
@wtf_dude Thank you so much, just put code into ToS working great. Any way to tie TTM squeeze into MACD cross? Love to have scanner show me if MACD has crossed.
 
@wtf_dude Thank you so much, just put code into ToS working great. Any way to tie TTM squeeze into MACD cross? Love to have scanner show me if MACD has crossed.
Just add a new condition and use the condition wizard for the macd cross. Then save the scan to include both
 
Right on, this is absolutely NOT the best way to pull this off but I can't think for **** atm as I'm on like 3 hours sleep. This should work fine. Ive noticed sometimes it will print 3 bars up vs only 2 every now and then, but it will get you alot of candidates. Don't worry about the condition wizard. Just copy paste this into thinkscript editor and you're done.

Code:
# ChiefCarl custom request by WTF_Dude
# Momentum wave turns up for 2 bars and spending at least 5 bars descending

declare lower;

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



   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), ATR_length);

def momobearup = Momo < 0 and Momo > Momo[1] and momo[1]>momo[2] and momo[2]<momo[3];

def change = absvalue(close - close[1]);

input min_bars =7;
def minreq = momo[3]<momo[4] and momo[4]<momo[5] and momo[5]<momo[6] and momo[6]<momo[7] and momo[7]<momo[8] and highest(momo,7)<0;
def twobarprint = momo>momo[1] and momo[1]>momo[2] and momo[3]<momo[4];


Plot BearMinMomentum = minreq and twobarprint;
@wtf_dude Thank you, love all your work!!

@chiefcarl Based on your testing, may i know what timeframe works best for this indicator?

Thanks all
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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