UDAY_C_Santhakumar

UCS Squeeze Bar

This indicator is a request from tvmember jackvmk. Credits to jackvmk.

Squeeze bar = a bar which encompasses 5, 10, 15, 20, 30, 40 SMA
Squeeze bars high and lows are support and resistance. when price break one of them, this direction is direction of explosion.

I have added a further more customization
1. Using EMA instead of SMA
2. Using Heikin Ashi Optimization
3. Using Realbody (ignore wicks)
4. Plot the MA Ribbon

Uday C Santhakumar
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
study(title="Squeeze Bar", shorttitle="Sqz Bar", overlay=true)

useHAC = input(true, title = "** Select this When Using Optimized Squeeze **", type=bool)
userb = input(true, title = "Ignore Wicks", type = bool)
plma = input(true, title = "Plot Moving Averages", type = bool)
masl = input(false, title = "Use EMA instead of SMA", 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))

src = useHAC ? haclose : close
sro = useHAC ? haopen : open

// MA Calculations
ma1 = masl ? ema(src,5) : sma(src,5)
ma2 = masl ? ema(src,10) : sma(src,10)
ma3 = masl ? ema(src,15) : sma(src,15)
ma4 = masl ? ema(src,20) : sma(src,20)
ma5 = masl ? ema(src,30) : sma(src,30)
ma6 = masl ? ema(src,40) : sma(src,40)

// High and Low
rblow = userb ? min(src, sro) : low
rbhig = userb ? max(src, sro) : high

// Squeeze Bar
sqzbar = (ma1 > rblow and ma1 < rbhig) and (ma2 > rblow and ma2 < rbhig) and (ma3 > rblow and ma3 < rbhig) and (ma4 > rblow and ma4 < rbhig) and (ma5 > rblow and ma5 < rbhig) and (ma6 > rblow and ma6 < rbhig)

// Bar Coloring
barcolor(sqzbar ? yellow : na)

// Ploting
plot(plma ? ma1 : na, title = "Moving Average", color = red, linewidth = 1)
plot(plma ? ma2 : na, title = "Moving Average", color = red, linewidth = 1)
plot(plma ? ma3 : na, title = "Moving Average", color = red, linewidth = 1)
plot(plma ? ma4 : na, title = "Moving Average", color = green, linewidth = 3)
plot(plma ? ma5 : na, title = "Moving Average", color = blue, linewidth = 2)
plot(plma ? ma6 : na, title = "Moving Average", color = gray, linewidth = 3)