Files
xPineScript/xSamples/indicators/stochastic.histogram.pine
2024-01-25 04:07:49 +03:30

19 lines
1.1 KiB
Plaintext

/////////////////////////////////////////////////////////////////////////////////////
// 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)