j1O9SB

Keltner Channels Oscillator v3

V2 with Bollinger Bands
Planning to make an STO/KCO hybrid and a model strategy for an all-in-one indicator.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="Keltner Channels Oscillator",shorttitle="KCO",overlay=false,precision=1)
//Inputs
bb_ubb=input(false,title="Always Show Bollinger Bands?")
kc_len=input(21,title="Keltner Channel Length")
kc_mult1=input(1,title="Keltner Channel First Multiple")
kc_mult2=input(2,title="Keltner Channel Second Multiple")
kc_src=input(close,title="Keltner Channel Source")
bb_len=input(20,title="Bollinger Bands SMA Length")
bb_src=input(close,title="Bollinger Bands SMA Source")
bb_mult=input(2.0,title="Bollinger Bands StDev Multiplier")
//BB code
bb_lvl=ema(bb_src,bb_len)
bb_dev=bb_mult*stdev(bb_src,bb_len)
bb_lvlup=bb_lvl+bb_dev
bb_lvldn=bb_lvl-bb_dev
//Keltner Channel
kc_ma=ema(kc_src,kc_len)
kc_rng=ema(tr,kc_len)
kc_oneup=kc_ma+kc_rng*kc_mult1
kc_onedn=kc_ma-kc_rng*kc_mult1
kc_twoup=kc_ma+kc_rng*kc_mult2
kc_twodn=kc_ma-kc_rng*kc_mult2
//Oscillator
kc_lvlclose=(close-kc_ma)/kc_rng
kc_lvlopen=(open-kc_ma)/kc_rng
kc_lvlhigh=(high-kc_ma)/kc_rng
kc_lvllow=(low-kc_ma)/kc_rng
kc_lvloneup=(kc_oneup-kc_ma)/kc_rng
kc_lvlonedn=(kc_onedn-kc_ma)/kc_rng
kc_lvltwoup=(kc_twoup-kc_ma)/kc_rng
kc_lvltwodn=(kc_twodn-kc_ma)/kc_rng
kc_bblvl=(bb_lvl-kc_ma)/kc_rng
kc_bblvlup=(bb_lvlup-kc_ma)/kc_rng
kc_bblvldn=(bb_lvldn-kc_ma)/kc_rng
//Color
kc_col=kc_lvlclose>0?green:red
kc_colbar=(close>open)?white:black
bb_colup=bb_ubb?black:high>=(bb_lvlup-kc_rng)?black:na
bb_coldn=bb_ubb?white:low<=(bb_lvldn+kc_rng)?white:na
//Plots
plot(kc_bblvlup,style=line,linewidth=2,color=bb_colup,transp=0,title="Upper BB")
plot(kc_bblvldn,style=line,linewidth=2,color=bb_coldn,transp=0,title="Lower BB")
plotbar(kc_lvlopen,kc_lvlhigh,kc_lvllow,kc_lvlclose,color=kc_colbar,editable=true)
hline(0,color=gray,linestyle=solid,editable=false)
hline(2,color=gray,linestyle=solid,editable=false)
hline(1,color=gray,linestyle=solid,editable=false)
hline(-1,color=gray,linestyle=solid,editable=false)
hline(-2,color=gray,linestyle=solid,editable=false)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out