Ta-Lib用法介绍 !

一、函数索引

重叠研究

BBANDS               Bollinger Bands
DEMA                 Double Exponential Moving Average
EMA                  Exponential Moving Average
HT_TRENDLINE         Hilbert Transform - Instantaneous Trendline
KAMA                 Kaufman Adaptive Moving Average
MA                   Moving average
MAMA                 MESA Adaptive Moving Average
MAVP                 Moving average with variable period
MIDPOINT             MidPoint over period
MIDPRICE             Midpoint Price over period
SAR                  Parabolic SAR
SAREXT               Parabolic SAR - Extended
SMA                  Simple Moving Average
T3                   Triple Exponential Moving Average (T3)
TEMA                 Triple Exponential Moving Average
TRIMA                Triangular Moving Average
WMA                  Weighted Moving Average

动能指标

ADX                  Average Directional Movement Index
ADXR                 Average Directional Movement Index Rating
APO                  Absolute Price Oscillator
AROON                Aroon
AROONOSC             Aroon Oscillator
BOP                  Balance Of Power
CCI                  Commodity Channel Index
CMO                  Chande Momentum Oscillator
DX                   Directional Movement Index
MACD                 Moving Average Convergence/Divergence
MACDEXT              MACD with controllable MA type
MACDFIX              Moving Average Convergence/Divergence Fix 12/26
MFI                  Money Flow Index
MINUS_DI             Minus Directional Indicator
MINUS_DM             Minus Directional Movement
MOM                  Momentum
PLUS_DI              Plus Directional Indicator
PLUS_DM              Plus Directional Movement
PPO                  Percentage Price Oscillator
ROC                  Rate of change : ((price/prevPrice)-1)*100
ROCP                 Rate of change Percentage: (price-prevPrice)/prevPrice
ROCR                 Rate of change ratio: (price/prevPrice)
ROCR100              Rate of change ratio 100 scale: (price/prevPrice)*100
RSI                  Relative Strength Index
STOCH                Stochastic
STOCHF               Stochastic Fast
STOCHRSI             Stochastic Relative Strength Index
TRIX                 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
ULTOSC               Ultimate Oscillator
WILLR                Williams' %R

体积指标

AD                   Chaikin A/D Line
ADOSC                Chaikin A/D Oscillator
OBV                  On Balance Volume

周期指标

HT_DCPERIOD          Hilbert Transform - Dominant Cycle Period
HT_DCPHASE           Hilbert Transform - Dominant Cycle Phase
HT_PHASOR            Hilbert Transform - Phasor Components
HT_SINE              Hilbert Transform - SineWave
HT_TRENDMODE         Hilbert Transform - Trend vs Cycle Mode

价格︰ 变换

AVGPRICE             Average Price
MEDPRICE             Median Price
TYPPRICE             Typical Price
WCLPRICE             Weighted Close Price

波动性指标

ATR                  Average True Range
NATR                 Normalized Average True Range
TRANGE               True Range

模式识别

CDL2CROWS            Two Crows
CDL3BLACKCROWS       Three Black Crows
CDL3INSIDE           Three Inside Up/Down
CDL3LINESTRIKE       Three-Line Strike
CDL3OUTSIDE          Three Outside Up/Down
CDL3STARSINSOUTH     Three Stars In The South
CDL3WHITESOLDIERS    Three Advancing White Soldiers
CDLABANDONEDBABY     Abandoned Baby
CDLADVANCEBLOCK      Advance Block
CDLBELTHOLD          Belt-hold
CDLBREAKAWAY         Breakaway
CDLCLOSINGMARUBOZU   Closing Marubozu
CDLCONCEALBABYSWALL  Concealing Baby Swallow
CDLCOUNTERATTACK     Counterattack
CDLDARKCLOUDCOVER    Dark Cloud Cover
CDLDOJI              Doji
CDLDOJISTAR          Doji Star
CDLDRAGONFLYDOJI     Dragonfly Doji
CDLENGULFING         Engulfing Pattern
CDLEVENINGDOJISTAR   Evening Doji Star
CDLEVENINGSTAR       Evening Star
CDLGAPSIDESIDEWHITE  Up/Down-gap side-by-side white lines
CDLGRAVESTONEDOJI    Gravestone Doji
CDLHAMMER            Hammer
CDLHANGINGMAN        Hanging Man
CDLHARAMI            Harami Pattern
CDLHARAMICROSS       Harami Cross Pattern
CDLHIGHWAVE          High-Wave Candle
CDLHIKKAKE           Hikkake Pattern
CDLHIKKAKEMOD        Modified Hikkake Pattern
CDLHOMINGPIGEON      Homing Pigeon
CDLIDENTICAL3CROWS   Identical Three Crows
CDLINNECK            In-Neck Pattern
CDLINVERTEDHAMMER    Inverted Hammer
CDLKICKING           Kicking
CDLKICKINGBYLENGTH   Kicking - bull/bear determined by the longer marubozu
CDLLADDERBOTTOM      Ladder Bottom
CDLLONGLEGGEDDOJI    Long Legged Doji
CDLLONGLINE          Long Line Candle
CDLMARUBOZU          Marubozu
CDLMATCHINGLOW       Matching Low
CDLMATHOLD           Mat Hold
CDLMORNINGDOJISTAR   Morning Doji Star
CDLMORNINGSTAR       Morning Star
CDLONNECK            On-Neck Pattern
CDLPIERCING          Piercing Pattern
CDLRICKSHAWMAN       Rickshaw Man
CDLRISEFALL3METHODS  Rising/Falling Three Methods
CDLSEPARATINGLINES   Separating Lines
CDLSHOOTINGSTAR      Shooting Star
CDLSHORTLINE         Short Line Candle
CDLSPINNINGTOP       Spinning Top
CDLSTALLEDPATTERN    Stalled Pattern
CDLSTICKSANDWICH     Stick Sandwich
CDLTAKURI            Takuri (Dragonfly Doji with very long lower shadow)
CDLTASUKIGAP         Tasuki Gap
CDLTHRUSTING         Thrusting Pattern
CDLTRISTAR           Tristar Pattern
CDLUNIQUE3RIVER      Unique 3 River
CDLUPSIDEGAP2CROWS   Upside Gap Two Crows
CDLXSIDEGAP3METHODS  Upside/Downside Gap Three Methods

统计函数

BETA                 Beta
CORREL               Pearson's Correlation Coefficient (r)
LINEARREG            Linear Regression
LINEARREG_ANGLE      Linear Regression Angle
LINEARREG_INTERCEPT  Linear Regression Intercept
LINEARREG_SLOPE      Linear Regression Slope
STDDEV               Standard Deviation
TSF                  Time Series Forecast
VAR                  Variance

数学变换

ACOS                 Vector Trigonometric ACos
ASIN                 Vector Trigonometric ASin
ATAN                 Vector Trigonometric ATan
CEIL                 Vector Ceil
COS                  Vector Trigonometric Cos
COSH                 Vector Trigonometric Cosh
EXP                  Vector Arithmetic Exp
FLOOR                Vector Floor
LN                   Vector Log Natural
LOG10                Vector Log10
SIN                  Vector Trigonometric Sin
SINH                 Vector Trigonometric Sinh
SQRT                 Vector Square Root
TAN                  Vector Trigonometric Tan
TANH                 Vector Trigonometric Tanh

数学运算符

ADD                  Vector Arithmetic Add
DIV                  Vector Arithmetic Div
MAX                  Highest value over a specified period
MAXINDEX             Index of highest value over a specified period
MIN                  Lowest value over a specified period
MININDEX             Index of lowest value over a specified period
MINMAX               Lowest and highest values over a specified period
MINMAXINDEX          Indexes of lowest and highest values over a specified period
MULT                 Vector Arithmetic Mult
SUB                  Vector Arithmetic Substraction
SUM                  Summation

 

 

二、函数用法

以下提供的用法仅作参考最好的方法是在程序内调用帮助程序。

# 导入TA-Lib
import talib
talib.OBV?

重叠研究功能

BBANDS-布林

upperband, middleband, lowerband = BBANDS(close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)

德玛-双指数移动平均线

real = DEMA(close, timeperiod=30)

EMA-指数移动平均线

real = EMA(close, timeperiod=30)

HT_TRENDLINE-希尔伯特变换-瞬时趋势线

real = HT_TRENDLINE(close)

卡马-考夫曼自适应移动平均

real = KAMA(close, timeperiod=30)

马-移动平均线

real = MA(close, timeperiod=30, matype=0)

妈妈-斯塔梅萨自适应移动平均

mama, fama = MAMA(close, fastlimit=0, slowlimit=0)

MAVP-移动平均线与可变期间

real = MAVP(close, periods, minperiod=2, maxperiod=30, matype=0)

中点-在期间中点

real = MIDPOINT(close, timeperiod=14)

MIDPRICE-中点价格同期

real = MIDPRICE(high, low, timeperiod=14)

SAR-抛物型特区

real = SAR(high, low, acceleration=0, maximum=0)

SAREXT-抛物型特区-扩展

real = SAREXT(high, low, startvalue=0, offsetonreverse=0, accelerationinitlong=0, 
accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0)

SMA-简单移动平均

real = SMA(close, timeperiod=30)

T3-三重指数移动平均 (T3)

real = T3(close, timeperiod=5, vfactor=0)

特马-三重指数移动平均

real = TEMA(close, timeperiod=30)

当时只好-三角移动平均线

real = TRIMA(close, timeperiod=30)

WMA-加权移动平均

real = WMA(close, timeperiod=30)

 

动量指标函数

ADX-平均定向运动指数

real = ADX(high, low, close, timeperiod=14)

ADXR-平均定向运动指数评级

real = ADXR(high, low, close, timeperiod=14)

载脂蛋白-绝对价格振荡器

real = APO(close, fastperiod=12, slowperiod=26, matype=0)

阿隆-阿隆

aroondown, aroonup = AROON(high, low, timeperiod=14)

AROONOSC-阿隆振荡器

real = AROONOSC(high, low, timeperiod=14)

国际收支平衡 — — 平衡的力量

real = BOP(open, high, low, close)

CCI-商品通道索引

real = CCI(high, low, close, timeperiod=14)

CMO-尚德势头振荡器

real = CMO(close, timeperiod=14)

DX-定向运动指数

real = DX(high, low, close, timeperiod=14)

MACD-移动平均线

macd, macdsignal, macdhist = MACD(close, fastperiod=12, slowperiod=26, signalperiod=9)

MACDEXT-MACD 与可控马类型

macd, macdsignal, macdhist = MACDEXT(close, fastperiod=12, fastmatype=0, slowperiod=26, 
slowmatype=0, signalperiod=9, signalmatype=0)

MACDFIX-移动平均线修复 12/26

macd, macdsignal, macdhist = MACDFIX(close, signalperiod=9)

MFI 资金流量指标

real = MFI(high, low, close, volume, timeperiod=14)

MINUS_DI-减去定向指标

real = MINUS_DI(high, low, close, timeperiod=14)

MINUS_DM-减去定向运动

real = MINUS_DM(high, low, timeperiod=14)

妈妈-势头

real = MOM(close, timeperiod=10)

PLUS_DI-再加上定向指标

real = PLUS_DI(high, low, close, timeperiod=14)

PLUS_DM-再加上定向运动

real = PLUS_DM(high, low, timeperiod=14)

多酚氧化酶-百分比价格振荡器

real = PPO(close, fastperiod=12, slowperiod=26, matype=0)

中华民国-变化率︰ ((price/prevPrice)-1) * 100

real = ROC(close, timeperiod=10)

ROCP-变化百分比率: (价格-prevPrice) / prevPrice

real = ROCP(close, timeperiod=10)

岩石-率的变化率: (价格/prevPrice)

real = ROCR(close, timeperiod=10)

ROCR100-率的变化比例 100: (价格/prevPrice) * 100

real = ROCR100(close, timeperiod=10)

相对强弱指标 RSI-

real = RSI(close, timeperiod=14)

托-随机

slowk, slowd = STOCH(high, low, close, fastk_period=5, slowk_period=3, slowk_matype=0, 
slowd_period=3, slowd_matype=0)

STOCHF-随机快速

fastk, fastd = STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0)

STOCHRSI-随机相对强弱指数

fastk, fastd = STOCHRSI(close, timeperiod=14, fastk_period=5, fastd_period=3, fastd_matype=0)

TRIX-1 天的变化率 (ROC) 的三重的光滑 EMA

real = TRIX(close, timeperiod=30)

ULTOSC-终极振荡器

real = ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28)

WILLR-威廉姆斯 %r

real = WILLR(high, low, close, timeperiod=14)

 

音量指示函数

AD-蔡金 A/D 线

real = AD(high, low, close, volume)

ADOSC-蔡金 A/D 振荡器

real = ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)

OBV-平衡卷上

real = OBV(close, volume)

 

波动性指标函数

ATR-真实波动幅度均值

real = ATR(high, low, close, timeperiod=14)

NATR-归一化真实波动幅度均值

real = NATR(high, low, close, timeperiod=14)

航天飞机-真实波动幅度

real = TRANGE(high, low, close)

 

价格转变职能

AVGPRICE-平均价格

real = AVGPRICE(open, high, low, close)

MEDPRICE-中位价

real = MEDPRICE(high, low)

TYPPRICE-典型价格

real = TYPPRICE(high, low, close)

WCLPRICE-加权收盘价

real = WCLPRICE(high, low, close)

 

循环指标函数

HT_DCPERIOD-希尔伯特变换-显性循环周期

real = HT_DCPERIOD(close)

HT_DCPHASE-希尔伯特变换-主导周期第一阶段

real = HT_DCPHASE(close)

HT_PHASOR-希尔伯特变换-相量组件

inphase, quadrature = HT_PHASOR(close)

HT_SINE-希尔伯特变换-正弦波

sine, leadsine = HT_SINE(close)

HT_TRENDMODE-希尔伯特变换-趋势 vs 周期模式

integer = HT_TRENDMODE(close)

 

模式识别功能

CDL2CROWS-两只乌鸦

integer = CDL2CROWS(open, high, low, close)

CDL3BLACKCROWS-三个黑色的乌鸦

integer = CDL3BLACKCROWS(open, high, low, close)

CDL3INSIDE-三个里面向上/向下

integer = CDL3INSIDE(open, high, low, close)

CDL3LINESTRIKE-三行罢工

integer = CDL3LINESTRIKE(open, high, low, close)

CDL3OUTSIDE-三个外部向上/向下

integer = CDL3OUTSIDE(open, high, low, close)

CDL3STARSINSOUTH-在南部的三颗星

integer = CDL3STARSINSOUTH(open, high, low, close)

CDL3WHITESOLDIERS-三推进白人士兵

integer = CDL3WHITESOLDIERS(open, high, low, close)

CDLABANDONEDBABY-被遗弃的男婴

integer = CDLABANDONEDBABY(open, high, low, close, penetration=0)

CDLADVANCEBLOCK-提前块

integer = CDLADVANCEBLOCK(open, high, low, close)

CDLBELTHOLD-带举行

integer = CDLBELTHOLD(open, high, low, close)

CDLBREAKAWAY-分离

integer = CDLBREAKAWAY(open, high, low, close)

CDLCLOSINGMARUBOZU-关闭 Marubozu

integer = CDLCLOSINGMARUBOZU(open, high, low, close)

CDLCONCEALBABYSWALL-隐瞒婴儿燕子

integer = CDLCONCEALBABYSWALL(open, high, low, close)

CDLCOUNTERATTACK-反击

integer = CDLCOUNTERATTACK(open, high, low, close)

CDLDARKCLOUDCOVER-乌云盖

integer = CDLDARKCLOUDCOVER(open, high, low, close, penetration=0)

CDLDOJI-十字星

integer = CDLDOJI(open, high, low, close)

CDLDOJISTAR-十字星明星

integer = CDLDOJISTAR(open, high, low, close)

CDLDRAGONFLYDOJI-蜻蜓十字星

integer = CDLDRAGONFLYDOJI(open, high, low, close)

CDLENGULFING-吞噬模式

integer = CDLENGULFING(open, high, low, close)

CDLEVENINGDOJISTAR-十字星明星晚报

integer = CDLEVENINGDOJISTAR(open, high, low, close, penetration=0)

CDLEVENINGSTAR-晚星

integer = CDLEVENINGSTAR(open, high, low, close, penetration=0)

CDLGAPSIDESIDEWHITE-向上/向下-差距肩并肩白线

integer = CDLGAPSIDESIDEWHITE(open, high, low, close)

CDLGRAVESTONEDOJI-墓碑十字星

integer = CDLGRAVESTONEDOJI(open, high, low, close)

CDLHAMMER-锤

integer = CDLHAMMER(open, high, low, close)

CDLHANGINGMAN-挂的人

integer = CDLHANGINGMAN(open, high, low, close)

CDLHARAMI-孕育形态

integer = CDLHARAMI(open, high, low, close)

CDLHARAMICROSS-哈拉米跨模式

integer = CDLHARAMICROSS(open, high, low, close)

CDLHIGHWAVE-高波蜡烛

integer = CDLHIGHWAVE(open, high, low, close)

CDLHIKKAKE-Hikkake 模式

integer = CDLHIKKAKE(open, high, low, close)

CDLHIKKAKEMOD-修改 Hikkake 模式

integer = CDLHIKKAKEMOD(open, high, low, close)

CDLHOMINGPIGEON-信鸽

integer = CDLHOMINGPIGEON(open, high, low, close)

CDLIDENTICAL3CROWS-相同的三个乌鸦

integer = CDLIDENTICAL3CROWS(open, high, low, close)

CDLINNECK-在颈部模式

integer = CDLINNECK(open, high, low, close)

CDLINVERTEDHAMMER-倒转锤头

integer = CDLINVERTEDHAMMER(open, high, low, close)

CDLKICKING-踢

integer = CDLKICKING(open, high, low, close)

CDLKICKINGBYLENGTH-踢-牛熊由长 marubozu

integer = CDLKICKINGBYLENGTH(open, high, low, close)

CDLLADDERBOTTOM-梯子底部

integer = CDLLADDERBOTTOM(open, high, low, close)

CDLLONGLEGGEDDOJI-长腿十字星

integer = CDLLONGLEGGEDDOJI(open, high, low, close)

CDLLONGLINE-长线蜡烛

integer = CDLLONGLINE(open, high, low, close)

CDLMARUBOZU-Marubozu

integer = CDLMARUBOZU(open, high, low, close)

CDLMATCHINGLOW-匹配低

integer = CDLMATCHINGLOW(open, high, low, close)

CDLMATHOLD-垫举行

integer = CDLMATHOLD(open, high, low, close, penetration=0)

CDLMORNINGDOJISTAR-十字星晨星

integer = CDLMORNINGDOJISTAR(open, high, low, close, penetration=0)

CDLMORNINGSTAR-晨星

integer = CDLMORNINGSTAR(open, high, low, close, penetration=0)

CDLONNECK-脖子上模式

integer = CDLONNECK(open, high, low, close)

CDLPIERCING-穿孔模式

integer = CDLPIERCING(open, high, low, close)

CDLRICKSHAWMAN-车夫

integer = CDLRICKSHAWMAN(open, high, low, close)

CDLRISEFALL3METHODS-上升/下降的三种方法

integer = CDLRISEFALL3METHODS(open, high, low, close)

CDLSEPARATINGLINES-分隔线

integer = CDLSEPARATINGLINES(open, high, low, close)

CDLSHOOTINGSTAR-流星

integer = CDLSHOOTINGSTAR(open, high, low, close)

CDLSHORTLINE-短线蜡烛

integer = CDLSHORTLINE(open, high, low, close)

CDLSPINNINGTOP-陀螺

integer = CDLSPINNINGTOP(open, high, low, close)

CDLSTALLEDPATTERN-停滞模式

integer = CDLSTALLEDPATTERN(open, high, low, close)

CDLSTICKSANDWICH-棍子三明治

integer = CDLSTICKSANDWICH(open, high, low, close)

CDLTAKURI-田栗 (蜻蜓与很长下影线的十字星)

integer = CDLTAKURI(open, high, low, close)

CDLTASUKIGAP-Tasuki 差距

integer = CDLTASUKIGAP(open, high, low, close)

CDLTHRUSTING-逆冲模式

integer = CDLTHRUSTING(open, high, low, close)

CDLTRISTAR-三星模式

integer = CDLTRISTAR(open, high, low, close)

CDLUNIQUE3RIVER-独特 3 河

integer = CDLUNIQUE3RIVER(open, high, low, close)

CDLUPSIDEGAP2CROWS-颠倒差距两乌鸦

integer = CDLUPSIDEGAP2CROWS(open, high, low, close)

CDLXSIDEGAP3METHODS-上行 / 下行差距三种方法

integer = CDLXSIDEGAP3METHODS(open, high, low, close)

 

统计函数

Β-β

real = BETA(high, low, timeperiod=5)

CORREL-皮尔逊的 Correlation Coefficient (r)

real = CORREL(high, low, timeperiod=30)

LINEARREG-线性回归

real = LINEARREG(close, timeperiod=14)

LINEARREG_ANGLE-线性回归角

real = LINEARREG_ANGLE(close, timeperiod=14)

LINEARREG_INTERCEPT-线性回归截距

real = LINEARREG_INTERCEPT(close, timeperiod=14)

LINEARREG_SLOPE-线性回归斜率

real = LINEARREG_SLOPE(close, timeperiod=14)

标准偏差-标准偏差

real = STDDEV(close, timeperiod=5, nbdev=1)

TSF-时间系列预测

real = TSF(close, timeperiod=14)

VAR-方差

real = VAR(close, timeperiod=5, nbdev=1)

 

数学变换函数

ACOS-矢量三角 ACos

real = ACOS(close)

阿信-矢量三角阿信

real = ASIN(close)

很小的时辰-矢量三角小的时辰

real = ATAN(close)

细胞-细胞向量

real = CEIL(close)

COS-矢量三角 Cos

real = COS(close)

吸烟与健康委员会-矢量三角余弦

real = COSH(close)

EXP-矢量运算 Exp

real = EXP(close)

矢量楼

real = FLOOR(close)

LN-矢量登录自然

real = LN(close)

LOG10-矢量 Log10

real = LOG10(close)

罪 — — 矢量三角罪

real = SIN(close)

SINH-矢量三角 Sinh

real = SINH(close)

SQRT-矢量平方根

real = SQRT(close)

谭-矢量三角滩

real = TAN(close)

TANH-矢量三角 Tanh

real = TANH(close)

 

数学运算符函数

添加-矢量算法添加

real = ADD(high, low)

DIV-向量算术 Div

real = DIV(high, low)

最大-在指定的期间的最高值

real = MAX(close, timeperiod=30)

MAXINDEX-在指定的期间的最高值的索引

integer = MAXINDEX(close, timeperiod=30)

MIN - Lowest value over a specified period

real = MIN(close, timeperiod=30)

MININDEX - Index of lowest value over a specified period

integer = MININDEX(close, timeperiod=30)

MINMAX - Lowest and highest values over a specified period

min, max = MINMAX(close, timeperiod=30)

MINMAXINDEX - Indexes of lowest and highest values over a specified period

minidx, maxidx = MINMAXINDEX(close, timeperiod=30)

MULT - Vector Arithmetic Mult

real = MULT(high, low)

SUB - Vector Arithmetic Substraction

real = SUB(high, low)

SUM - Summation

real = SUM(close, timeperiod=30)

转载于:https://www.cnblogs.com/wumac/p/6950974.html

你可能感兴趣的:(Ta-Lib用法介绍 !)