1、TaLib与技术分析技术分析是股票分析十分有效直接的手段,在实际投资中我们常常需要计算各种简单或复杂的技术指标来分析参考
对于技术指标的定义基本都大同小异,很多都是通用的且模块化的东西
对于不会写代码或者不想自己写函数计算这些技术指标的人而言,强大的Talib给我们带来了福音
只需要调用Talib的函数,输入简单的参数就可以得到自己想要的结果
2、初看Talib
先简单看看Talib都给我们提供了那些计算技术指标的函数,按技术指标的类型列示如下:
Overlap Studies Functions
BBANDS - Bollinger Bands
upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)
DEMA - Double Exponential Moving Average
real = DEMA(close, timeperiod=30)
EMA - Exponential Moving Average
real = EMA(close, timeperiod=30)
HT_TRENDLINE - Hilbert Transform - Instantaneous Trendline
real = HT_TRENDLINE(close)
KAMA - Kaufman Adaptive Moving Average
real = KAMA(close, timeperiod=30)
MA - Moving average
real = MA(close, timeperiod=30, matype=0)
MAMA - MESA Adaptive Moving Average
mama, fama = MAMA(close, fastlimit=0, slowlimit=0)
MAVP - Moving average with variable period
real = MAVP(close, periods, minperiod=2, maxperiod=30, matype=0)
MIDPOINT - MidPoint over period
real = MIDPOINT(close, timeperiod=14)
MIDPRICE - Midpoint Price over period
real = MIDPRICE(high, low, timeperiod=14)
SAR - Parabolic SAR
real = SAR(high, low, acceleration=0, maximum=0)
SAREXT - Parabolic SAR - Extended
real = SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0,
accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0)
SMA - Simple Moving Average
real = SMA(close, timeperiod=30)
T3 - Triple Exponential Moving Average (T3)
real = T3(close, timeperiod=5, vfactor=0)
TEMA - Triple Exponential Moving Average
real = TEMA(close, timeperiod=30)
TRIMA - Triangular Moving Average
real = TRIMA(close, timeperiod=30)
WMA - Weighted Moving Average
real = WMA(close, timeperiod=30)
Momentum Indicator Functions
ADX - Average Directional Movement Index
real = ADX(high, low, close, timeperiod=14)
ADXR - Average Directional Movement Index Rating
real = ADXR(high, low, close, ti