indicator · own pane · open source
Slow Stochastic
Running…
Loading chart…
About
Slow Stochastic smooths %K one extra time before plotting — cleaner and less noisy than fast Stoch. The default in most trading platforms.
- Above 80 = overbought, below 20 = oversold.
- %K crossing %D in extreme territory is the textbook trigger.
- Raise smoothing for steadier signals.
Source code
//@version=5
indicator("Slow Stochastic", overlay=false)
len = input.int(14, "%K Length", minval=2, maxval=200)
kSmooth = input.int(3, "%K Smoothing", minval=1, maxval=50)
dlen = input.int(3, "%D Smoothing", minval=1, maxval=50)
src = input.source("close", "Source")
hh = ta.highest(high, len)
ll = ta.lowest(low, len)
rawK = 100.0 * (src - ll) / (hh - ll)
k = ta.sma(rawK, kSmooth)
d = ta.sma(k, dlen)
hline(80, "Overbought", color=color.gray, linestyle=hline.style_dashed)
hline(20, "Oversold", color=color.gray, linestyle=hline.style_dashed)
p_Slow__K = plot(k, "Slow %K", color=color.blue, linewidth=2)
p_Slow__D = plot(d, "Slow %D", color=color.orange)
alertcondition(ta.crossover(k, d) and k < 20, "Slow Stoch cross up in OS", "Slow Stoch crossed signal in oversold")
alertcondition(ta.crossunder(k, d) and k > 80, "Slow Stoch cross down in OB", "Slow Stoch crossed signal in overbought")
No comments yet.
Sign in to comment.