UDAY_C_Santhakumar

UCS_Squeeze_Momentum_Optimized_Overlay

UDAY_C_Santhakumar Wizard Güncellendi   
Squeeze Overlay Indicator - Save some screen real estate.
1. Further Optimized Version
Yorum:
Finally the Squeeze Trigger Indicator is coming to a good position to trade. A bit more tweaks needed.

Yorum:
Yorum:

Uday C Santhakumar
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
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)