John Carter's Squeeze Pro Indicator for ThinkorSwim (FREE)

would it be possible to get an in-depth explanation of ways to use it? much appreciated

The image in this post:
https://usethinkscript.com/threads/...r-for-thinkorswim-free.4021/page-3#post-91733
is called a trending dashboard.
NUOGzXZ.png

It uses different lengths to confirm the trend.

The shorter lengths are displayed first. Alerting you to the reversal.
As you worked down through the plotted lines; the display uses longer lengths.
As they turn green the trend is confirmed.

Where and when you decide to enter, is based on your level of RiskReward
 
Last edited:
Ruby:
# Momo arrows
input price = close;
input length = 20;
def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def momo = Inertia(price - K / 2, length);

plot BuyArrow = momo crosses above -2.5 ;
BuyArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot SellArrow = momo crosses below 2.5 ;
SellArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
I added the following at the end of the code but the arrows do not show. What am I doing wrong? Please advise. Thanks.

plot BuyArrow = momo crosses above -2.5 ;
BuyArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot SellArrow = momo crosses below 2.5 ;
SellArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
 
I added the following at the end of the code but the arrows do not show. What am I doing wrong? Please advise. Thanks.

plot BuyArrow = momo crosses above -2.5 ;
BuyArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot SellArrow = momo crosses below 2.5 ;
SellArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
You can add this study to chart in the following two ways:
Ruby:
# Momo arrows
input price = close;
input length = 20;
def K = (Highest(high, length) + Lowest(low, length)) / 2 + ExpAverage(close, length);
def momo = Inertia(price - K / 2, length);

plot BuyArrow = momo crosses above -2.5 ;
BuyArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

plot SellArrow = momo crosses below 2.5 ;
SellArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

1. Here is a tutorial for cutting and pasting a study into your chart:
https://usethinkscript.com/threads/how-to-import-existing-thinkscript-code-on-thinkorswim.10/

or

2. you can import the chart below using
this shared chart link: http://tos.mx/aIzlPi5 Click here for --> Easiest way to load shared links

It should be noted that I couldn't find a stock with a histogram that went down to -2.5 or up to 2.5.
In the below example, the numbers were changed to -2.0 and 2.0
Feel free to change the parameters to fit your needs.
bGoGTSO.png
 
Has anyone converted the lower squeeze pro oscillator to color the upper chart candles (four color) to match lower trend colors?

John Carter's Squeeze Pro Indicator for ThinkorSwim (FREE)
I derived John Carter's Pro Squeeze indicator. All it looks like he does is add in more conditional rules on whether BBs are inside a larger and smaller range. The code is actually pretty simple just added a few Keltner ranges and added in Mobius's derivation of the original TTM Squeeze's momentum function.

Dark_orange is the pre-squeeze, yellow signals the original, and red is one step above actual i.e., extreme compression.

View attachment 8145

Thanks,

TheBewb

Code:
declare lower;

##Assembled by TheBewb using existing Mobius Squeeze Momentum coding and "squeeze" concept made popular by John Carter.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input displace = 0;
def sDev = StDev(data = price[-displace], length = length);
def MidLineBB = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev;
def UpperBandBB = MidLineBB + Num_Dev_up * sDev;
input factorhigh = 1.0;
input factormid = 1.5;
input factorlow = 2.0;
input trueRangeAverageType = AverageType.SIMPLE;
def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);

def Avg = average[-displace];

def UpperBandKCLow = average[-displace] + shiftlow[-displace];
def LowerBandKCLow = average[-displace] - shiftlow[-displace];

def UpperBandKCMid = average[-displace] + shiftMid[-displace];
def LowerBandKCMid = average[-displace] - shiftMid[-displace];

def UpperBandKCHigh = average[-displace] + shifthigh[-displace];
def LowerBandKCHigh = average[-displace] - shifthigh[-displace];

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

def pos         = momo>= 0;
def neg         = momo< 0;
def up         = momo >= momo[1];
def dn         = momo < momo[1];

def presqueeze      = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow;
def originalSqueeze     = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid;
def ExtrSqueeze     = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh;

def PosUp = pos and up;
def PosDn = pos and dn;
def NegDn = neg and dn;
def NegUp = neg and up;

plot squeezeline = 0;
squeezeline.SetPaintingStrategy(PaintingStrategy.POINTS);
squeezeline.AssignValueColor(if ExtrSqueeze then Color.RED else if originalSqueeze  then Color.YELLOW else if presqueeze then Color.DARK_ORANGE else Color.GRAY);

plot momentum = momo;
momentum.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
momentum.AssignValueColor( if PosUp then Color.green else if PosDn then Color.dark_green else if NegDn then Color.dark_orange else if NegUp then Color.yellow else Color.YELLOW);
Has anyone been able to convert this to show the chart candles in the same colors
 
Last edited by a moderator:
Has anyone converted the lower squeeze pro oscillator to color the upper chart candles (four color) to match lower trend colors?


Has anyone been able to convert this to show the chart candles in the same colors

Basically, to paint candles,
you copy everything after the AssignValueColor statement in a script (which colors the plot)
AssignValueColor( if PosUp then Color.green else if PosDn then Color.dark_green else if NegDn then Color.dark_orange else if NegUp then Color.yellow else Color.YELLOW);
and stick it in an AssignPriceColor statement (which colors the candles)
AssignPriceColor( if PosUp then Color.green else if PosDn then Color.dark_green else if NegDn then Color.dark_orange else if NegUp then Color.yellow else Color.YELLOW);
and voilà, you have painted candles.

Here is the completed candle painting script:
Ruby:
# upper candle painting study only
##Assembled by TheBewb using existing Mobius Squeeze Momentum coding and "squeeze" concept made popular by John Carter.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input displace = 0;
def sDev = StDev(data = price[-displace], length = length);
def MidLineBB = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev;
def UpperBandBB = MidLineBB + Num_Dev_up * sDev;
input factorhigh = 1.0;
input factormid = 1.5;
input factorlow = 2.0;
input trueRangeAverageType = AverageType.SIMPLE;
def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);

def Avg = average[-displace];

def UpperBandKCLow = average[-displace] + shiftlow[-displace];
def LowerBandKCLow = average[-displace] - shiftlow[-displace];

def UpperBandKCMid = average[-displace] + shiftMid[-displace];
def LowerBandKCMid = average[-displace] - shiftMid[-displace];

def UpperBandKCHigh = average[-displace] + shifthigh[-displace];
def LowerBandKCHigh = average[-displace] - shifthigh[-displace];

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

def pos         = momo>= 0;
def neg         = momo< 0;
def up         = momo >= momo[1];
def dn         = momo < momo[1];

def presqueeze      = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow;
def originalSqueeze     = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid;
def ExtrSqueeze     = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh;

def PosUp = pos and up;
def PosDn = pos and dn;
def NegDn = neg and dn;
def NegUp = neg and up;

AssignPriceColor( if PosUp then Color.green else if PosDn then Color.dark_green else if NegDn then Color.dark_orange else if NegUp then Color.yellow else Color.YELLOW);
 
Last edited:
Thanks!!!

Basically, to paint candles,
you copy everything after the AssignValueColor statement in a script

and stick it in an AssignPriceColor statement

and voilà, you have painted candles.

Here is the completed candle painting script:
Ruby:
# upper candle painting study only
##Assembled by TheBewb using existing Mobius Squeeze Momentum coding and "squeeze" concept made popular by John Carter.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input displace = 0;
def sDev = StDev(data = price[-displace], length = length);
def MidLineBB = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev;
def UpperBandBB = MidLineBB + Num_Dev_up * sDev;
input factorhigh = 1.0;
input factormid = 1.5;
input factorlow = 2.0;
input trueRangeAverageType = AverageType.SIMPLE;
def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);

def Avg = average[-displace];

def UpperBandKCLow = average[-displace] + shiftlow[-displace];
def LowerBandKCLow = average[-displace] - shiftlow[-displace];

def UpperBandKCMid = average[-displace] + shiftMid[-displace];
def LowerBandKCMid = average[-displace] - shiftMid[-displace];

def UpperBandKCHigh = average[-displace] + shifthigh[-displace];
def LowerBandKCHigh = average[-displace] - shifthigh[-displace];

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

def pos         = momo>= 0;
def neg         = momo< 0;
def up         = momo >= momo[1];
def dn         = momo < momo[1];

def presqueeze      = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow;
def originalSqueeze     = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid;
def ExtrSqueeze     = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh;

def PosUp = pos and up;
def PosDn = pos and dn;
def NegDn = neg and dn;
def NegUp = neg and up;

AssignPriceColor( if PosUp then Color.green else if PosDn then Color.dark_green else if NegDn then Color.dark_orange else if NegUp then Color.yellow else Color.YELLOW);
 
Last edited by a moderator:
could you elaborate on it--ZScore, how to decide?!

How do you use it to determine direction sqz will fire??
Z-score oscillator
https://usethinkscript.com/threads/z-score-indicator-for-thinkorswim.16970/
measures how far a data point is from the mean, displaying whether it's above or below the average.

It helps you assess whether a stock's price is unusually high or low compared to its historical average.
If the z-score is positive, the stock may be overvalued, and if it's negative, it may be undervalued.

If the squeeze happens when the z-score is negative, the OP is opining that it is more likely to signal an upward move.
 
Last edited:
Hello everyone, I'm wondering if any of you can provide the code for the John Carter's TTM SQUEEZE PRO WITH SCANNER?
 
looking for 30 minute, 1hr a watchlist code for this

declare lower;

##Assembled by TheBewb using existing Mobius Squeeze Momentum coding and "squeeze" concept made popular by John Carter.

input price = close;
input length = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input averageType = AverageType.SIMPLE;
input displace = 0;
def sDev = StDev(data = price[-displace], length = length);
def MidLineBB = MovingAverage(averageType, data = price[-displace], length = length);
def LowerBandBB = MidLineBB + Num_Dev_Dn * sDev;
def UpperBandBB = MidLineBB + Num_Dev_up * sDev;
input factorhigh = 1.0;
input factormid = 1.5;
input factorlow = 2.0;
input trueRangeAverageType = AverageType.SIMPLE;
def shifthigh = factorhigh * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftMid = factormid * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def shiftlow = factorlow * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);

def Avg = average[-displace];

def UpperBandKCLow = average[-displace] + shiftlow[-displace];
def LowerBandKCLow = average[-displace] - shiftlow[-displace];

def UpperBandKCMid = average[-displace] + shiftMid[-displace];
def LowerBandKCMid = average[-displace] - shiftMid[-displace];

def UpperBandKCHigh = average[-displace] + shifthigh[-displace];
def LowerBandKCHigh = average[-displace] - shifthigh[-displace];

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

def pos = momo >= 0;
def neg = momo < 0;
def up = momo >= momo[1];
def dn = momo < momo[1];

def presqueeze = LowerBandBB > LowerBandKCLow and UpperBandBB < UpperBandKCLow;
def originalSqueeze = LowerBandBB > LowerBandKCMid and UpperBandBB < UpperBandKCMid;
def ExtrSqueeze = LowerBandBB > LowerBandKCHigh and UpperBandBB < UpperBandKCHigh;

def PosUp = pos and up;
def PosDn = pos and dn;
def NegDn = neg and dn;
def NegUp = neg and up;

plot squeezeline = 0;
squeezeline.SetPaintingStrategy(PaintingStrategy.POINTS);
squeezeline.AssignValueColor(if ExtrSqueeze then Color.yellow else if originalSqueeze then Color.RED else if presqueeze then Color.GRAY else Color.GREEN);

plot momentum = momo;
momentum.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
momentum.AssignValueColor( if PosUp then Color.CYAN else if PosDn then Color.BLUE else if NegDn then Color.RED else if NegUp then Color.YELLOW else Color.YELLOW);
 
Hi All - this is great - but is there a way to make the dots bigger? They are tiny on the histogram - I've noticed that on other charts they are about 3x larger - very difficult to see on this. I checked the TOS painting strategy docs, but not seeing a solution there.

squeezeline.SetLineWeight(3);
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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