//@version=5
indicator(title="BB+Keltner Channels", shorttitle="BB+KC", overlay=true, timeframe="", timeframe_gaps=true)
//KC1
kc1length = input.int(10, minval=1)
kc1mult = input(2.0, "Multiplier")
kc1src = input(close, title="Source")
kc1exp = input(true, "Use Exponential MA")
kc1BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="kc1Bands Style")
kc1atrlength = input(10, "kc1ATR Length")
kc1esma(source, kc1length)=>
s = ta.sma(source, kc1length)
e = ta.ema(source, kc1length)
kc1exp ? e : s
kc1ma = kc1esma(kc1src, kc1length)
kc1rangema = kc1BandsStyle == "True Range" ? ta.tr(true) : kc1BandsStyle == "Average True Range" ? ta.atr(kc1atrlength) : ta.rma(high - low, kc1length)
kc1upper = kc1ma + kc1rangema * kc1mult
kc1lower = kc1ma - kc1rangema * kc1mult
kc1u = plot(kc1upper, color=#FFBB00, title="kc1Upper")
plot(kc1ma, color=#FFBB00, title="kc1Basis")
kc1l = plot(kc1lower, color=#FFBB00, title="kc1Lower")
fill(kc1u, kc1l, color=#FFD8D8, title="Background")
//KC2
kc2length = input.int(20, minval=1)
kc2mult = input(2.0, "Multiplier")
kc2src = input(close, title="Source")
kc2exp = input(true, "Use Exponential MA")
kc2BandsStyle = input.string("Average True Range", options = ["Average True Range", "True Range", "Range"], title="kc2Bands Style")
kc2atrlength = input(10, "kc2ATR Length")
kc2esma(source, kc2length)=>
s = ta.sma(source, kc2length)
e = ta.ema(source, kc2length)
kc2exp ? e : s
kc2ma = kc2esma(kc2src, kc2length)
kc2rangema = kc2BandsStyle == "True Range" ? ta.tr(true) : kc2BandsStyle == "Average True Range" ? ta.atr(kc2atrlength) : ta.rma(high - low, kc2length)
kc2upper = kc2ma + kc2rangema * kc2mult
kc2lower = kc2ma - kc2rangema * kc2mult
kc2u = plot(kc2upper, color=#FF0000, title="kc2Upper")
plot(kc2ma, color=#FF0000, title="kc2Basis")
kc2l = plot(kc2lower, color=#FF0000, title="kc2Lower")
fill(kc2u, kc2l, color=#FFE08C, title="Background")
//BB1
BB1length = input.int(20, minval=1)
BB1src = input(close, title="Source")
BB1mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
BB1basis = ta.sma(BB1src, BB1length)
BB1dev = BB1mult * ta.stdev(BB1src, BB1length)
BB1upper = BB1basis + BB1dev
BB1lower = BB1basis - BB1dev
offset = input.int(0, "Offset", minval = -500, maxval = 500)
plot(BB1basis, "BB1Basis", color=#BDBDBD, offset = offset)
BB1p1 = plot(BB1upper, "BB1Upper", color=#1DDB16, offset = offset)
BB1p2 = plot(BB1lower, "BB1Lower", color=#1DDB16, offset = offset)
fill(BB1p1, BB1p2, title = "Background", color=#B7F0B1)
//BB2
BB2length = input.int(75, minval=1)
BB2src = input(close, title="Source")
BB2mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev")
BB2basis = ta.sma(BB2src, BB2length)
BB2dev = BB2mult * ta.stdev(BB2src, BB2length)
BB2upper = BB2basis + BB2dev
BB2lower = BB2basis - BB2dev
plot(BB2basis, "BB2Basis", color=#BDBDBD, offset = offset)
BB2p1 = plot(BB2upper, "BB2Upper", color=#000000, offset = offset)
BB2p2 = plot(BB2lower, "BB2Lower", color=#000000, offset = offset)
fill(BB2p1, BB2p2, title = "Background", color=#D5D5D5)
배경 투명도는 직접 조절해야 하고 설정창이 조금 엉망으로 나오네요;;;
'차트기술적분석 > 기술적분석법' 카테고리의 다른 글
캔들 차트 패턴 분석법 NR 4 / NR 7 Pattern (0) | 2022.03.09 |
---|---|
보조지표 ] 스토케스틱(Stochastic) 계산식, 활용법 (0) | 2022.02.17 |
보조지표 ] 추세의 전환을 알기위한 어썸오실레이터 -Awesome Oscillator-AO (계산식, 활용법) (0) | 2022.02.11 |
다모다란의 투자전략 바이블 中 책이 주는 투자전략 교훈 #2 (0) | 2022.02.10 |
다모다란의 투자전략 바이블 中 책이 주는 투자전략 교훈 # 1 (0) | 2022.02.10 |
댓글