You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you wonder why STOCHRSI gives you different results than you expect, probably you want STOCH applied to RSI, which is a little different than the STOCHRSI which is STOCHF applied to RSI:
>>> import talib
>>> import numpy as np
>>> c = np.random.randn(100)
# this is the library function
>>> k, d = talib.STOCHRSI(c)
# this produces the same result, calling STOCHF
>>> rsi = talib.RSI(c)
>>> k, d = talib.STOCHF(rsi, rsi, rsi)
# you might want this instead, calling STOCH
>>> rsi = talib.RSI(c)
>>> k, d = talib.STOCH(rsi, rsi, rsi)
I happened to be that guy in the description, unfortunately. This is a little confusing to me, what are k and d!? Why do you give rsi 3 times to STOCH? You can safely ignore the comments, but I mentioned them, if you're curious what my intentions are for calculation of this indicator.
The fast (%K) and slow (%d) stochastic oscillator.
Why do you give rsi 3 times to STOCH?
The STOCH takes a "high", "low", and "close" price series arguments.
The STOCHF is described as the "fast stochastic", but basically it's not smoothed like the STOCH version. That's sometimes what people want.
/*
* TA_STOCH - Stochastic
*
* Input = High, Low, Close
* Output = double, double
*
* Optional Parameters
* -------------------
* optInFastK_Period:(From 1 to 100000)
* Time period for building the Fast-K line
*
* optInSlowK_Period:(From 1 to 100000)
* Smoothing for making the Slow-K line. Usually set to 3
*
* optInSlowK_MAType:
* Type of Moving Average for Slow-K
*
* optInSlowD_Period:(From 1 to 100000)
* Smoothing for making the Slow-D line
*
* optInSlowD_MAType:
* Type of Moving Average for Slow-D
*
*
*/
STOCH(high, low, close, fastk_period=-2147483648, slowk_period=-2147483648, slowk_matype=0, slowd_period=-2147483648, slowd_matype=0)
STOCH(high, low, close[, fastk_period=?, slowk_period=?, slowk_matype=?, slowd_period=?, slowd_matype=?])
Stochastic (Momentum Indicators)
Inputs:
prices: ['high', 'low', 'close']
Parameters:
fastk_period: 5
slowk_period: 3
slowk_matype: 0
slowd_period: 3
slowd_matype: 0
Outputs:
slowk
slowd
/*
* TA_STOCHF - Stochastic Fast
*
* Input = High, Low, Close
* Output = double, double
*
* Optional Parameters
* -------------------
* optInFastK_Period:(From 1 to 100000)
* Time period for building the Fast-K line
*
* optInFastD_Period:(From 1 to 100000)
* Smoothing for making the Fast-D line. Usually set to 3
*
* optInFastD_MAType:
* Type of Moving Average for Fast-D
*
*
*/
STOCHF(high, low, close, fastk_period=-2147483648, fastd_period=-2147483648, fastd_matype=0)
STOCHF(high, low, close[, fastk_period=?, fastd_period=?, fastd_matype=?])
Stochastic Fast (Momentum Indicators)
Inputs:
prices: ['high', 'low', 'close']
Parameters:
fastk_period: 5
fastd_period: 3
fastd_matype: 0
Outputs:
fastk
fastd
In your documentation you say:
If you wonder why STOCHRSI gives you different results than you expect, probably you want STOCH applied to RSI, which is a little different than the STOCHRSI which is STOCHF applied to RSI:
I happened to be that guy in the description, unfortunately. This is a little confusing to me, what are
k
andd
!? Why do you give rsi 3 times toSTOCH
? You can safely ignore the comments, but I mentioned them, if you're curious what my intentions are for calculation of this indicator.Here's how I used your library in my app:
The text was updated successfully, but these errors were encountered: