Functions
talib.stoch()
Stochastic. It is calculated by a formula: 100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length)).
Syntax
talib.stoch(series float source, series float high, series float low, series int length) → series float
Arguments
source required series float Source series. high required series float Series of high. low required series float Series of low. length required series int Length (number of bars back). Return Type
series float Example
indicator("Stochastic Oscillator", overlay=false)
length = input(14, "Stochastic Length")
stochValue = talib.stoch(close, high, low, length)
plot(stochValue, color=color.blue, title="%K Line")
hline(80, "Overbought", color=color.red)
hline(20, "Oversold", color=color.green)