ta.stoch()
Stochastic Oscillator
Stochastic oscillator. It is calculated by a formula: 100 * (source - lowest(low, length)) / (highest(high, length) - lowest(low, length)).
Syntax
ta.stoch(source, high, low, length) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| source | series int/float | Series compared to the range (commonly close). |
| high | series int/float | High series for the range calculation. |
| low | series int/float | Low series for the range calculation. |
| length | series int | Lookback length for highest/lowest range. |
Returns
Stochastic.
Remarks
None.
Code Examples
//@version=6
indicator("ta.stoch")
plot(ta.stoch(close, high, low, 14))Trading Applications
Identify overbought/oversold market conditions
Generate buy/sell signals with %K/%D crossovers
Detect bullish/bearish divergences
Combine with trend analysis for filtered entries
Frequently Asked Questions
Generate ta.stoch() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.stoch() and other built-in functions instantly.
Related Pine Script Functions
ta.rsi() - Relative Strength Index
Learn how to use ta.rsi() in Pine Script. Syntax, parameters, code examples for the RSI momentum oscillator.
ta.cci() - Commodity Channel Index
Learn how to use ta.cci() in Pine Script. Syntax, parameters, code examples for the CCI momentum indicator.
ta.cmo() - Chande Momentum Oscillator
Learn how to use ta.cmo() in Pine Script. Syntax, parameters, code examples for the Chande Momentum Oscillator.
ta.wpr() - Williams %R
Learn how to use ta.wpr() in Pine Script. Syntax, parameters, code examples for the Williams Percent R oscillator.
ta.mfi() - Money Flow Index
Learn how to use ta.mfi() in Pine Script. Syntax, parameters, code examples for the volume-weighted RSI indicator.