The talib.STOCH()
function is used to calculate the Stochastic (STOCH indicator).
The return value of the talib.STOCH()
function is a two-dimensional array.
array
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)
The inPriceHLC
parameter is used to specify the K-line data.
inPriceHLC
true
{@struct/Record Record} structure array
The optInFastK_Period
parameter is used to set the Fast-K period, the default value is 5.
optInFastK_Period
false
number
The optInSlowK_Period
parameter is used to set the Slow-K period, the default value is 3.
optInSlowK_Period
false
number
The optInSlowK_MAType
parameter is used to set the Slow-K average type, the default value is 0.
optInSlowK_MAType
false
number
The optInSlowD_Period
parameter is used to set the Slow-D period, the default value is 3.
optInSlowD_Period
false
number
The optInSlowD_MAType
parameter is used to set the Slow-D average type, the default value is 0.
optInSlowD_MAType
false
number
function main() {
var records = exchange.GetRecords()
var ret = talib.STOCH(records)
Log(ret)
}
import talib
def main():
records = exchange.GetRecords()
ret = talib.STOCH(records.High, records.Low, records.Close)
Log(ret)
void main() {
auto records = exchange.GetRecords();
auto ret = talib.STOCH(records);
Log(ret);
}
The STOCH()
function is described in the talib library documentation as: 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)]