indicator · own pane · open source
Stochastic indicator
Stochastic is a free open-source indicator by @deepwick. Stochastic Oscillator plots where the close sits within the recent high-low range. Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Stochastic does
Stochastic Oscillator plots where the close sits within the recent high-low range. %K is the raw oscillator; %D is the smoothed version.
- Above 80 = overbought, below 20 = oversold.
- %K crossing above %D in the oversold zone is the textbook buy.
- Raise
Lengthto filter noise, lower it for faster reversals.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Stochastic", overlay=false)
len = input.int(14, "%K Length", minval=2, maxval=200)
dlen = input.int(3, "%D Smoothing", minval=1, maxval=50)
src = input.source(close, "Source")
colorLine = input.color("color.blue", "Color Line")
colorMid = input.color("color.orange", "Color Mid")
colorNeutral = input.color("color.gray", "Color Neutral")
hh = ta.highest(high, len)
ll = ta.lowest(low, len)
k = 100.0 * (src - ll) / (hh - ll)
d = ta.sma(k, dlen)
hline(80, "Overbought", color=colorNeutral, linestyle=hline.style_dashed)
hline(20, "Oversold", color=colorNeutral, linestyle=hline.style_dashed)
p__K = plot(k, "%K", color=colorLine, linewidth=2)
p__D = plot(d, "%D", color=colorMid)
alertcondition(ta.crossover(k, d) and k < 20, "Stoch cross up in OS", "Stochastic %K crossed %D in oversold")
alertcondition(ta.crossunder(k, d) and k > 80, "Stoch cross down in OB", "Stochastic %K crossed %D in overbought")
No comments yet.
Sign in to comment.