kingthies

KBC

kingthies 已更新   
KBC combines the logarithmic bollinger bands with keltner channels.
發布通知:
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.
發布通知:
Logarithmic Fix
發布通知:
Upgrading script from pine v4 to pine v5

Eric Thies
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?