nboone

Stochastic Histogram

Last Edited: 5/19/16

Description:
This is a basic Stochastic histogram that essentially shows when the indicator
is either above or below the 50 level. Colors can be customized to your liking.
Length and smoothing factor can be adjusted as well. Defaults are 14 (Length)
and 3 (Smoothing Factor).


NOTE: The above chart contains the built-in stochastic indicator for comparison.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
/////////////////////////////////////////////////////////////////////////////////////
// Last Edited: 5/19/16                                                            //    
// Created By: nboone                                                              //
//                                                                                 //
// Description:                                                                    //
// This is a basic Stochastic histogram that essentially shows when the indicator  //
// is either above or below the 50 level. Colors can be customized to your liking. //
// Length and smoothing factor can be adjusted as well. Defaults are 14 (Length)   //
// and 3 (Smoothing Factor).                                                       //                
/////////////////////////////////////////////////////////////////////////////////////
study(title="Stochastic Histogram", shorttitle="NB_StochHist")
length = input(14, minval=1)
smoothK = input(3, minval=1)

k = (sma(stoch(close, high, low, length), smoothK) - 50)
c = (k > 0) ? green : (k < 0) ? red : black

plot(k, style=histogram, color=c)
plot(k, color=black)