Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
Overlap Studies
Momentum Indicators
Volume Indicators
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Calculates the Stochastic and returns the slow %K and slow %D.

talib.STOCH(inPriceHLC)
talib.STOCH(inPriceHLC, optInFastK_Period)
talib.STOCH(inPriceHLC, optInFastK_Period, optInSlowK_Period)
talib.STOCH(inPriceHLC, optInFastK_Period, optInSlowK_Period, optInSlowK_MAType)
talib.STOCH(inPriceHLC, optInFastK_Period, optInSlowK_Period, optInSlowK_MAType, optInSlowD_Period)
talib.STOCH(inPriceHLC, optInFastK_Period, optInSlowK_Period, optInSlowK_MAType, optInSlowD_Period, optInSlowD_MAType)

Examples

Compute the Stochastic from the latest K-lines.

javascript
function main() { var records = exchange.GetRecords() if (!records) return var ret = talib.STOCH(records) // Output: [slow %K array, slow %D array] Log(ret) }
python
import talib def main(): records = exchange.GetRecords() if not records: return ret = talib.STOCH(records.High, records.Low, records.Close) # Output: (slow %K array, slow %D array) Log(ret)

Returns

TypeDescription

array

Two-dimensional array: [slow %K array, slow %D array] (a tuple in the same order in Python).

Arguments

NameTypeRequiredDescription

inPriceHLC

Record array

Yes

K-line array; the high, low and close fields are used. In Python, pass records.High, records.Low, records.Close in this order.

optInFastK_Period

number

No

Fast %K period. Default 5.

optInSlowK_Period

number

No

Slow %K period. Default 3.

optInSlowK_MAType

number

No

Moving average type of slow %K; see the MAType table on the Talib page. Default 0 (SMA).

optInSlowD_Period

number

No

Slow %D period. Default 3.

optInSlowD_MAType

number

No

Moving average type of slow %D; see the MAType table on the Talib page. Default 0 (SMA).

See Also

Remarks

TA-Lib equivalent: STOCH(Records[High,Low,Close],Fast-K Period = 5,Slow-K Period = 3,Slow-K MA = 0,Slow-D Period = 3,Slow-D MA = 0) = [Array(outSlowK),Array(outSlowD)].