TA-Lib 指标翻译及用法整理
TA-Lib 指标翻译及用法整理
参数说明
MA_Type / matype 移动平均类型
由TA-Lib库定义,在指标函数中,可以用数字或英文缩写表示所使用的移动平均类型,下表为对照:
数字 | 缩写 |
---|---|
0 | SMA(默认) |
1 | EMA |
2 | WMA |
3 | DEMA |
4 | TEMA |
5 | TRIMA |
6 | KAMA |
7 | MAMA |
8 | T3 |
OHLCV参数
特定时间段(如一天、一小时、一分钟等)内某种资产(如股票、期货、外汇等)的价格变动情况。OHLCV 分别代表开盘价(Open)、最高价(High)、最低价(Low)、收盘价(Close)和交易量(Volume)。在示例中分别用open、high、low、close与volume表示。
Overlap Studies 交叉分析
BBANDS
布林带指标 Bollinger Bands
# 价格从下方穿越上线可能意味着买入机会,从上方穿越下线可能意味着卖出机会
# 较宽的布林带表明价格波动较高,较窄的布林表明波动较低
close, timeperiod=5, nbdevup=2, nbdevdn=2, matype=0)
upperband, middleband, lowerband = BBANDS(# close 收盘价
# timeperiod 计算周期(日) 默认5天
# nbdevup 上轨线标准差倍数 默认2倍
# nbdevdn 下轨线标准差倍数 默认2倍
# matype 选用的滑动平均类型
DEMA
双指数移动平均线 Double Exponential Moving Average
# 减少价格变动的滞后效应,对市场的短期变动更敏感
real = DEMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
EMA
指数移动平均线 Exponential MovingAverage
# 对近期的价格变动赋予更大的权重,比SMA更能反映市场的近期趋势
real = EMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
HT_TRENDLINE
希尔伯特瞬时变换 Hilbert Transform - Instantaneous Trendline
# 反映信号在某一时刻的局部趋势或方向
real = HT_TRENDLINE(close)
# close 收盘价
# close长度大于63后才会得出实际数值指标
KAMA
考夫曼自适应移动平均线 Kaufman Adaptive Moving Average
# 基于价格变动自适应调整权重的一种移动平均线
real = KAMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
MA
移动平均线 Moving average
real = MA(close, timeperiod=30, matype=0)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
# matype 选用的滑动平均类型
MAMA
MESA自适应移动平均线 MESA Adaptive Moving Average
# 根据市场条件自动调整其计算方式
close, fastlimit=0.9, slowlimit=0.1)
mama, fama = MAMA(# close 收盘价
# fastlimit 快极限
# slowlimit 慢极限
# fastlimit、slowlimit的取值范围为大于0且小于1(不可取等)
MAVP
可变周期的移动平均线 Moving average with variable period
real = MAVP(close, periods, minperiod=2, maxperiod=30, matype=0)
# close 收盘价
# periods 周期
# minperiod 最小周期
# maxperiod 最大周期
# matype 选用的滑动平均类型
# periods与close长度需相等,用于指定对应位置的收盘价的计算周期
MIDPOINT
周期中点 MidPoint over period
# 某一特定时间段内价格的中点
real = MIDPOINT(close, timeperiod=14)
# close 收盘价
# timeperiod 计算周期(日) 默认14天
MIDPRICE
周期中点价 Midpoint Price over period
real = MIDPRICE(high, low, timeperiod=14)
# high 最高价
# low 最低价
# timeperiod 计算周期(日) 默认14天
SAR
抛物线指标 Parabolic SAR
# 当价格趋势向上时,在价格下方生成一系列潜在支撑位
# 当价格趋势向下时,在价格上方生成一系列潜在阻力位
real = SAR(high, low, acceleration=0, maximum=0)
# high 最高价
# low 最低价
# acceleration 加速因子
SAREXT
扩展抛物线指标 Parabolic SAR - Extended
# 当价格趋势向上时,在价格下方生成一系列潜在支撑位
# 当价格趋势向下时,在价格上方生成一系列潜在阻力位
real = SAREXT(high, low, startvalue=0, offsetonreverse=0,accelerationinitlong=0, accelerationlong=0, accelerationmaxlong=0, accelerationinitshort=0, accelerationshort=0, accelerationmaxshort=0)
# high 最高价
# low 最低价
# startvalue 初始值
# offsetonreverse 反转偏移量
# accelerationinitlong 长期趋势的初始加速度
# accelerationlong 长期加速度的增量
# accelerationmaxlong 长期趋势加速度的最大值
# accelerationinitshort 短期趋势的初始加速度
# accelerationshort 短期加速度的增量
# accelerationmaxshort 短期趋势加速度的最大值
SMA
简单移动平均线 Simple Moving Average
real = SMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
T3
三重指数移动平均线T3 Triple Exponential Moving Average (T3)
# 通过消除双重指数移动平均线延迟的问题来提高移动平均线的响应能力
real = T3(close, timeperiod=5, vfactor=0)
# close 收盘价
# timeperiod 计算周期(日) 默认5天
TEMA
三重指数移动平均线 Triple Exponential Moving Average
# 平滑价格波动,从而更容易识别趋势,而不会出现与传统移动平均线 (MA) 相关的滞后
real = TEMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
TRIMA
三角型移动平均线 Triangular Moving Average
# 简单移动平均线进行再平均
real = TRIMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
WMA
权重移动平均线 Weighted Moving Average
# 对最近的时间的计算权重更高
real = WMA(close, timeperiod=30)
# close 收盘价
# timeperiod 计算周期(日) 默认30天
Momentum Indicators动量指标
ADX
平均方向性运动指标 Average Directional Movement Index
real = ADX(high, low, close, timeperiod=14)
# high:最高价;
# low:最低价;
# close:收盘价;
# timeperiod:时间周期
# 注意:该函数的周期不稳定。
ADXR
平均方向性运动指标评估 Average Directional Movement Index Rating
real = ADXR(high, low, close, timeperiod=14)
# high:最高价;
# low:最低价;
# close:收盘价;
# timeperiod:时间周期
# 注意:该函数的周期不稳定。
APO
绝对价格振荡指标 Absolute Price Oscillator
real = APO(close, fastperiod=12, slowperiod=26, matype=0)
# close:收盘价;
# fastperiod:快周期;
# slowperiod:慢周期
# matype:选用的平均滑动类型
AROON
阿隆指标 Aroon
14)
aroondown, aroonup = AROON(high, low, timeperiod=# high:最高价;
# low:最低价;
# timeperiod:时间周期
AROONOSC
阿隆震荡线 Aroon Oscillator
real = AROONOSC(high, low, timeperiod=14)
# high:最高价;
# low:最低价;
# timeperiod:时间周期
BOP
能量均衡 Balance Of Power
open, high, low, close)
real = BOP(# high:最高价;
# low:最低价;
# close:收盘价;
# open:开盘价
CCI
商品通道指数/顺势指标 Commodity Channel Index
real = CCI(high, low, close, timeperiod=14)
# high:最高价;
# low:最低价;
# close:收盘价;
# timeperiod:时间周期
CMO
钱德动量摆动指标 Chande Momentum Oscillator
real = CMO(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
DX
动向指数 Directional Movement Index
real = DX(high, low, close, timeperiod=14)
# high:最高价;
# low:最低价;
# close:收盘价;
# timeperiod:时间周期
MACD
移动平均线收敛/发散指标 Moving Average Convergence/Divergence
close, fastperiod=12, slowperiod=26, signalperiod=9)
macd, macdsignal, macdhist = MACD(# high:最高价;
# low:最低价;
# close:收盘价;
# fastperiod:快周期;
# slowperiod:慢周期
MACDEXT
MACD扩展 MACD with controllable MA type
close, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0)
macd, macdsignal, macdhist = MACDEXT(# close:收盘价;
# fastmatype:快速EMA计算类型的整数
# fastperiod:快周期
# slowperiod:慢速EMA计算类型的整数
# slowperiod:慢周期
# signalperiod: 信号周期
# signalmatype:信号采用的移动平均方法
MACDFIX
MACD修正 Moving Average
Volume Indicators 成交量指标
AD
蔡金A/D线 Chaikin A/D Line
# A/D线上升,表示买/多方力量增强,市场处于上升趋势
# A/D线下降,表示卖/空方力量增强,市场处于下降趋势
real = AD(high, low, close, volume)
# high 最高价
# low 最低价
# close 收盘价
# volume 交易量
ADOSC
蔡金A/D震荡指标 Chaikin A/D Oscillator
# 蔡金摆动指标的值大于0时,买入压力较高
# 蔡金摆动指标的值低于0时,抛售压力较高
real = ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)
# high 最高价
# low 最低价
# close 收盘价
# volume 交易量
# fastperiod 快速移动平均使用的周期数
# slowperiod 慢速移动平均使用的周期数
OBV
平衡交易量 On Balance Volume
# 累计指标,累计当日价格。若涨价则加上,若降价则减去
real = OBV(close, volume)
# close 收盘价
# volume 交易量
Volatility Indicators 波动率指标
ATR
平均真实波幅 Average True Range
# ATR较高,市场波动性较大,存在较大的风险和机会
# ATR较低,市场相对平稳,交易机会可能较少
real = ATR(high, low, close, timeperiod=14)
# high 最高价
# low 最低价
# close 收盘价
# timeperiod 计算周期(日) 默认14天
NATR
归一化平均真实波幅 Normalized Average True Range
real = NATR(high, low, close, timeperiod=14)
# high 最高价
# low 最低价
# close 收盘价
# timeperiod 计算周期(日) 默认14天
TRANGE
真实波幅 True Range
# TRANGE较高,市场波动性较大,交易机会和风险并存
# TRANGE较低,市场相对平稳,交易机会较少
real = TRANGE(high, low, close)
# high 最高价
# low 最低价
# close 收盘价
Price Transform 价格变换指标
AVGPRICE
平均价格 Average Price
open, high, low, close)
real = AVGPRICE(# open 开盘价
# high 最高价
# low 最低价
# close 收盘价
MEDPRICE
中位价格 Median Price
real = MEDPRICE(high, low)
# high 最高价
# low 最低价
TYPPRICE
典型价格 Typical Price
real = TYPPRICE(high, low, close)
# high 最高价
# low 最低价
# close 收盘价
WCLPRICE
加权收盘价 Weighted Close Price
real = WCLPRICE(high, low, close)
# high 最高价
# low 最低价
# close 收盘价
Cycle Indicators 周期指标
HT_DCPERIOD
希尔伯特变换-主导周期 Hilbert Transform - Dominant Cycle Period
real = HT_DCPERIOD(close)
# close:收盘价;
HT_DCPHASE
希尔伯特变换-主导相位 Hilbert Transform - Dominant Cycle Phase
real = HT_DCPHASE(close)
# close:收盘价;
HT_PHASOR
希尔伯特变换-同相分量与正交分量 Hilbert Transform - Phasor Components
close)
inphase, quadrature = HT_PHASOR(# close:收盘价;
HT_SINE Hilbert
希尔伯特变换-正弦波 Transform - SineWave
close)
sine, leadsine = HT_SINE(# close:收盘价;
HT_TRENDMODE
希尔伯特变换-趋势与周期模式 Hilbert Transform - Trend vs Cycle Mode
integer = HT_TRENDMODE(close)
# close:收盘价;
Statistic Functions 统计函数
BETA
β系数 Beta
real = BETA(high, low, timeperiod=5)
# high:最高价;
# low:最低价;
# timeperiod:时间周期
CORREL
皮尔森相关系数 Pearson’s Correlation Coefficient (r)
integer = HT_TRENDMODE(close)
# close:收盘价;
LINEARREG
线性回归 Linear Regression
real = LINEARREG(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
LINEARREG_ANGLE
线性回归角度 Linear Regression Angle
real = LINEARREG_ANGLE(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
LINEARREG_INTERCEPT
线性回归截距 Linear Regression Intercept
real = LINEARREG_INTERCEPT(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
LINEARREG_SLOPE
线性回归斜率 Linear Regression Slope
real = LINEARREG_SLOPE(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
STDDEV
标准差 Standard Deviation
real = STDDEV(close, timeperiod=5, nbdev=1)
# close:收盘价;
# timeperiod:时间周期
# nbdev:标准差倍数
TSF
时间序列预测 Time Series Forecast
real = TSF(close, timeperiod=14)
# close:收盘价;
# timeperiod:时间周期
VAR
方差 Variance
real = VAR(close, timeperiod=5, nbdev=1)
# close:收盘价;
# timeperiod:时间周期
# nbdev:标准差倍数
全部 0条评论