ucsgears

UCS_Squeeze_Momentum-Optimized_Alert

1061 0 171
Squeeze Momentum - Alert Indicator.

Set alerts for as many bars as you like. For reference on how to set alerts, please watch the video from Chris Moody, Link - http://videos.tradingview.com/video/114269353
Remove from Favorite Scripts Add to Favorite Scripts
// Heikin Ashi Optimization Applied

study(shorttitle = "UCS_SQZ_Opt_Alert", title="UCS_Squeeze_Momentum-Optimized_Alert", 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) ? sqzOn[1]+1 : 0
sqzOff = (lowerBB < lowerKC) ? sqzOff[1]+1 : 0
noSqz  = (sqzOn == false) and (sqzOff == false)

plot (sqzOn, title = "In Squeeze", color = red, style = columns)
plot (sqzOff, title = "Squeeze Fired", color = green, style = columns)
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
日本
한국
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
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out