kingthies

KBC

kingthies Mis à jour   
KBC combines the logarithmic bollinger bands with keltner channels.
Notes de version:
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.
Notes de version:
Logarithmic Fix
Notes de version:
Upgrading script from pine v4 to pine v5

Eric Thies
Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?