321 Lift Off Another Squeeze Indicator for ThinkorSwim


New member
Here is a Squeeze Indicator that resembles TTM_Squeeze of John Carter
Link: https://researchtrade.com/forum/read.php?7,2258,page=59#:~:text=Here is a Squeeze Indicator that resemble to TTM_Squeez of John Carter

declare lower;

Input Length = 20; # Length for Avg True Range & Std. Dev Calcs
Input Price = Close; # type of price to use
Input minPriceMove = 1; # for scaling
Input priceIncrement = 0.01;
Input nK = 1.5; # Keltner Channel ATRs from Average
Input nBB = 2; # Bollinger Band Std. Devs. from Average
Input AlertLine = 1; # BBS_Index level at which to issue alerts
Input SqueezeOnColor = 2;
Input SqueezeOffColor = 6;

# scaling factor :
def LHMult = if (priceIncrement <> 0, (minPriceMove/priceIncrement), 0);

# Average True Range
def ATR = AvgTrueRange(high, close, low, Length);

# Standard Deviation
def SDev = stdev(Price, Length);

# -- Calculate Bollinger Band Squeeze Indicator --
# for alert
def Denom = (nK*ATR);
def BBS_Ind = if (Denom <> 0, ((nBB * SDev) /Denom), 0);

# -- Plot the Index & Alert Line -------------------------
plot BBS_Index = 0;
BBS_Index.assignValueColor(if BBS_Ind < Alertline then Color.Red else Color.Blue);

# --------------------------------------------------------
# -- Plot delta of price from Donchian mid line ----------
# Inertia = LinearRegValue
def LinearRegValue = Inertia(price-((Highest(high, Length)+Lowest(low, Length))/2 + ExpAverage(close,Length))/2,Length);

#Plot the Green Values
def LRVGreens = if (LinearRegValue >= 0, LinearRegValue, 0);

plot BBSqueeze_Pos = LRVGreens * LHMult;
BBSqueeze_Pos.assignValueColor(if LRVGreens > LRVGreens[1] then Color.Green else Color.Dark_Green);

#Plot the Red Values
def LRVReds = if (LinearRegValue < 0, LinearRegValue, 0);
plot BBSqueeze_Neg = LRVReds * LHMult;
BBSqueeze_Neg.assignValueColor(if LRVReds < LRVReds[1] then Color.Red else Color.Dark_Red);

#Show Alert Dots
def BBS_CrossOverAlert = if (BBS_Ind > BBS_Ind[1] and (BBS_Ind > AlertLine) and (BBS_Ind[1] < AlertLine), (LRVGreens * LHMult + 150 * minPriceMove), 0);
plot CrossOverAlert = if BBS_CrossOverAlert > 0 then BBS_CrossOverAlert else Double.NaN;

# Alert("BB Squeeze Alert");
def BBS_CrossUnderAlert = if (BBS_Ind < BBS_Ind[1] and (BBS_Ind < AlertLine) and (BBS_Ind[1] > AlertLine), (LRVReds * LHMult - 150 * minPriceMove), 0);
plot CrossUnderAlert = if BBS_CrossUnderAlert < 0 then BBS_CrossUnderAlert else Double.NaN;
CrossUnderAlert.assignValueColor(GetColor(SqueezeOffColor)); # Color.Light_red);
#-----------------------------------------------------------end of code
Last edited by a moderator:

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

Thread starter Similar threads Forum Replies Date
mbarcala Blast Off Momentum from Trading View For ThinkOrSwim Custom 1

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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