# UCS_Squeeze_Momentum_Optimized_Overlay

2184 3
Squeeze Overlay Indicator - Save some screen real estate.
1. Further Optimized Version
Comment: Finally the Squeeze Trigger Indicator is coming to a good position to trade. A bit more tweaks needed.

Comment:
Comment:
study(shorttitle = "UCS_SQUEEZE", title="UCS_Squeeze_Momentum_Optimized_Overlay", overlay=true)

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)

scolor = noSqz ? blue : sqzOn ? red : green

// Background Highlight
bgcolor(scolor)
// Momentum arrows
positiveup = (val > 0) and (val > val[1])
positivedn = (val > 0) and (val < val[1])
negativedn = (val < 0) and (val < val[1])
negativeup = (val < 0) and (val > val[1])

plotshape (positiveup ? positiveup : na, title = "Momentum Positive & Up", style = shape.triangleup, location = location.top, color = green)
plotshape (positivedn ? positivedn : na, title = "Momentum Positive & Down", style = shape.triangledown, location = location.top, color = blue)
plotshape (negativeup ? negativeup : na, title = "Momentum Negative & Up", style = shape.triangleup, location = location.bottom, color = orange)
plotshape (negativedn ? negativedn : na, title = "Momentum Negative & Down", style = shape.triangledown, location = location.bottom, color = red)

## Related Ideas

a New Squeeze Bar technique, introduced to me by @jackvmk. Coding in progress. Will be out tonight.
ucsgears
Interesting...
ucsgears
Looking forward to it.
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter