trading.kay27

Kay_BBandsV3

This is the 3rd version of Kay_BBands.

When +DI (Directional Index ) is above -DI , then Upper band will be visible and vice-versa.
This is when the ADX is above the threshold. 28 is the default in this version. I found its more appealing in 5M time frame.

BLUE - ADX under 10
GREEN - Uptrend, ADX over 10
RED - Downtrend, ADX over 10

Use it with another band with setting 20, 0.6 deviation. Prices keeping above or below the 2nd bands upper or lower bounds shows trending conditions.

I didn't know how to update the old script so published it again.
Changes - :
1) Updated default settings for the indicator
2) ADX setting are now DI (28), ADX (10), adx level to check is 10.
3) IMPORTANT one - When DI is up/down, lower/upper band will also have color (more visible that way.)

Play around the settings.. It really eliminates extra indicator checking visually... Please like if you think idea is good.

오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
//version=2
//2nd version of the band
study(shorttitle="Kay_BBv3", title="Kay_BBandsV3", overlay=true)
length = input(20, minval=1)
hl = input(false, title="Band source as high/low ?", type=bool)
Usrc = hl ? high : close // input(high/Low, title="Upper Src")
Lsrc = hl ? low : close //input(low, title="Lower Src")
mult = input(2.0, minval=0.001, maxval=50)
basis = input(false, title="Use EMA ?", type=bool) ? ema(close, length) : sma(close, length)
isU = close > basis
isD = close < basis

//2 diviation
upperB = basis + (mult * stdev(Usrc, length))
lowerB = basis - (mult * stdev(Lsrc, length))

//1 Diviation
upperB1 = basis + ((mult/2) * stdev(Usrc, length))
lowerB1 = basis - ((mult/2) * stdev(Lsrc, length))

//upper = isU and highest(Usrc, length) == Usrc ? upperB : upperB < fixnan(upper[1]) ? upperB : fixnan(upper[1])
//lower = isD and lowest(Lsrc, length) == Lsrc ? lowerB : lowerB > fixnan(lower[1]) ? lowerB : fixnan(lower[1])

//Adx
adxlen = input(10, title="ADX Smoothing")
dilen = input(28, title="DI Length")
dirmov(len) =>
	up = change(high)
	down = -change(low)
	truerange = rma(tr, len)
	plus = fixnan(100 * rma(up > down and up > 0 ? up : 0, len) / truerange)
	minus = fixnan(100 * rma(down > up and down > 0 ? down : 0, len) / truerange)
	[plus, minus]

adx(dilen, adxlen) => 
	[plus, minus] = dirmov(dilen)
	sum = plus + minus
	adx = 100 * rma(abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)

[plus1, minus1] = dirmov(dilen)
sig = adx(dilen, adxlen)
level = input(10, title="ADX level", minval = 1)

plot(basis, color=sig > level ? red : blue, title="BB Basis")
//p1 = plot(upper, color=black, title="BB Upper modified", transp=0)
//p2 = plot(lower, color=black, title="BB Lower modified", transp=0)
//fill(p1, p2, color=blue, transp=90, title="Modified")

p1 = plot(upperB, color=sig > level ? (plus1 > minus1 ? #00C600 : #7D7D7D) : blue, title="BB Upper", transp=0)
p2 = plot(lowerB, color=sig > level ? (plus1 < minus1 ? #FF0000 : #7D7D7D) : blue, title="BB Lower", transp=0)
fill(p1, p2, color=blue, transp=95, title="Background")

p3 = plot(upperB1, color=sig > level ? (plus1 > minus1 ? #00C600 : #7D7D7D) : blue, title="BB Upper", transp=0)
p4 = plot(lowerB1, color=sig > level ? (plus1 < minus1 ? #FF0000 : #7D7D7D) : blue, title="BB Lower", transp=0)
fill(p3, p4, color=red, transp=95, title="Background")