kingthies

KBC

kingthies Atualizado   
KBC combines the logarithmic bollinger bands with keltner channels.
Notas de Lançamento:
Keltner Channel + Bollinger Band Combination
Concept published by Eric Thies 2018 | Updated 2021

U+2588 Changes Made
  • Upgraded to Pine v4 + Visual Plotting Updated
  • Removal of logarithmic input, replaced with standard calculation
  • Source formatted to updated and recommended look

// [pine]
// © kingthies | This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/

//@version=4
study(title="Keltner + Bollinger Band Combination [kingthies]", shorttitle="KBC [kingthies]", overlay=true) 

// !<------ Inputs & Strings -------> 
src = input(close, type=input.source, title="Bollinger and Keltner Source"), length = input(20, minval=1, title="BBand Length"), mult = input(2.0, minval=0.001, maxval=50, title="BBand Standard Deviations"), 
offset = input(0, title="Offset"), basis = sma(src, length), dev = mult * stdev(src, length), upper = basis + dev, lower = basis - dev
useTrueRange = input(true, title='Toggle True Range on Kelts?'), keltlength = input(20, minval=1, title="Kelt Length (20 Default)"), keltmult = input(1.0, title='Kelt Multiple')
keltsrc = src, ma = ema(keltsrc, length), range = useTrueRange ? tr : high - low, rangema = ema(range, keltlength)
upperkelt = ma + rangema * keltmult, lowerkelt = ma - rangema * keltmult

// !<----- Plotting -------- > 
upperBB = plot(upper, transp=0, color=color.white, linewidth=2,offset=offset, title="Upper BBand (2 St Dev Default)")
lowerBB = plot(lower, transp=0, color=color.white,linewidth=2, offset=offset, title="Lower BBand (2 St. Dev Default)")
u = plot(upperkelt, color=color.white, title="Upper Keltner Channel"), l = plot(lowerkelt, color=color.white, linewidth=1, title="Lower Keltner Channel")
plot(basis, transp=0,linewidth=2, color=color.red, title="Bollinger Basis (20MA Default)"), plot(ma, color=color.red, title="Keltner Basis")
fill(u, l, color=color.aqua, transp=80, title='Keltner Channel Fill'), fill(upperBB, lowerBB, color=color.aqua,transp=80, title="BBand Fill")
// [/pine]

For information regarding the calculation and use of Bollinger Bands or Keltner Channels, the resources provided here on Tradingview are available by searching in the toolbar above.
Notas de Lançamento:
Logarithmic Fix
Notas de Lançamento:
Upgrading script from pine v4 to pine v5

Eric Thies
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?