How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# UCS_Squeeze_Optimization

1262 16
Squeeze Momentum Indicator - Optimized

All Updates from Version 3 + Squeeze Optimized further.
// Heikin Ashi Optimization Applied

study(shorttitle = "UCS_SQZ_Opt", title="UCS_Squeeze Momentum - Optimized", overlay=false)

length = input(20, title="Squeeze Length")
multBB = input(2,title="BB MultFactor")
multKC = input(1.5, title="KC MultFactor")
smooth = input(20, title = "Momentum Smoothing")

usebbr = input(true, title = "Use Bollinger Band Ratio Instead of Momentum", type = bool)
useHAC = input(true, title = "Heikin Ashi Optimization", type=bool)

// Heikin Ashi ATR Calculations
haclose = ohlc4
haopen = na(haopen[1]) ? (open + close)/2 : (haopen[1] + haclose[1]) / 2
hahigh = max (high, max(haopen,haclose))
halow = min (low, min(haopen,haclose))
haatra = abs(hahigh - haclose[1])
haatrb = abs(haclose[1] - halow)
haatrc = abs(hahigh - halow)
haatr = max(haatra, max(haatrb,haatrc))

source = useHAC ? haclose : close

// Calculate BB
basis = sma(source, length)
dev = multBB * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev

// Calculate KC
ma = sma(source, length)
range = useHAC ? haatr : tr
rangema = sma(range, length)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC

sqzOn  = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz  = (sqzOn == false) and (sqzOff == false)

// Momentum ======> %B Indicator OR Rate of Change (ROC)
momentum = usebbr ? (((source - lowerBB)/(upperBB - lowerBB))-0.5) : (((close - close[12])/close[12])*100)
val = sma(momentum,smooth)

// Plot Statements
bcolor = iff( val > 0,
iff( val > nz(val[1]), green, blue),
iff( val < nz(val[1]), red, orange))
scolor = noSqz ? blue : sqzOn ? red : green
plot(val, color=bcolor, style=histogram, linewidth=3)
plot(0, color=scolor, style=circles, linewidth=3)

## Related Ideas

For those who doesn't like the Optimized Squeeze - Just uncheck the Heikin Ashi Optimization in the Input Dialog box.
I really have become a fan of your work! I wonder if you have done any side-by-side comparisons to the "classic" (Carter-style) Squeeze scripts for signals or outcomes? My suspicion is that you are getting faster (better positioning and thus better R:R) and perhaps also better directional success (better returns). Regardless I applaud your work and curious if you have already done the comparisons?
Alphaoptions
Well, John Carter Squeeze = uncheck - Heikin Ashi Optimization & Use Bollinger Band Ratio instead of Momentum.
ucsgears
Great way to visualize and compare. You are better identifying the consolidation periods and action within those consolidation periods without sacrificing the turn sensitivity for the most part. Really a nice work! Since you are so far ahead of us of this work, maybe when you have time you could share thoughts on how you like to use it for entries and for exits. Maybe your thoughts too on how you interpret gray versus black zero line in context of each histogram color for example. And since you said this is not the final piece you could preview what you are planning to do. Also i am thinking your FibGrid might be good at helping anticipate the potential turning areas (post squeeze release exhaustion points) since anticipating not only the squeeze exits but also the post release fade points would add to the complete package you are building. Cheers and thanks you for sharing all your great work with us!
Alphaoptions
There are two ways to enter, Its got to do with the nature of how they want to manage risk. Buying the support / Selling the resistance & Buying / Selling at breakout. Squeeze is just an indicator.
There are sooo many ways this tool can be used! Here I simply overlapped a longer time frame (weekly) momentum over the one day momentum. This tool makes spotting divergence extremely easy.

coondawg71
Great illustration coondawg!
Alphaoptions
thanks ! just like to help with what I see, what I know, UCS GEARS puts up great tools. I can go on and on and on, but I wouldnt want to hi-jack the thread.
coondawg71
Thanks for sharing ideas.
ucsgears
You are very welcome, and thank you for your generosity !
coondawg71
coondawg71
coondawg71
sorry wrong

Hello, I just joined so not sure how active this thread is. I'm very interested in using the 'Squeeze event' for trading...I have access to TTM_Squeeze on ThinkorSwim. But I'll be interested if I can try your versions using this sites charts. Is there by chance a way to use your Squeeze indicator on the stock screener to find stocks that fit a breakout scenario. Actually I'm interested in a different use. I would like to be able to scan for stocks that on the Weekly chart data signal a first red dot(begin of squeeze) with a few other conditions; above 52sma, price > \$40, and large trade volume.
Is there any way I could use your indicator to scan for such stocks?
Is there an easy way for your code to be translated into Thinkscript for TOS?
Thanks
NeoFitz
There is no way to scan for stocks in Tradingview, Yet. TOS have scanners. The codes from TV can be translated. Provided you can convert them, Its simple.
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter