TA-lib 动量指标

TA-Lib中Momentum Indicators(动量指标)的详细介绍以及如何应用这些指标的示例代码。

1. ADX (Average Directional Movement Index)

简介:ADX是一个衡量趋势强度的指标,结合了+DI和-DI。

import talib
import numpy as np

high = np.random.random(100)
low = np.random.random(100)
close = np.random.random(100)

result = talib.ADX(high, low, close, timeperiod=14)
 

2. ADXR (Average Directional Movement Rating)

简介:ADXR是ADX的移动平均线,用于平滑ADX值。

result = talib.ADXR(high, low, close, timeperiod=14)

3. APO (Absolute Price Oscillator)

简介:APO是价格与其n周期简单移动平均线的差值。

result = talib.APO(close, fastperiod=12, slowperiod=26, matype=0)

4. AROON (Aroon)

简介:Aroon指标显示一定时间窗口内价格达到最高和最低点的时间比例。

aroon_down, aroon_up = talib.AROON(high, low, timeperiod=14)

5. AROONOSC (Aroon Oscillator)

简介:AROONOSC是Aroon指标的振荡器版本。

result = talib.AROONOSC(high, low, timeperiod=14)

6. BOP (Balance of Power)

简介:BOP是衡量买卖力量平衡的指标。

result = talib.BOP(open, high, low, close)

7. CCI (Commodity Channel Index)

简介:CCI是衡量当前价格是否超出正常范围的指标。

result = talib.CCI(high, low, close, timeperiod=14)

8. CMO (Chande Momentum Oscillator)

简介:CMO是动量指标,显示价格相对于过去价格的变化。

result = talib.CMO(close, timeperiod=14)

9. DX (Directional Movement Index)

简介:DX是+DI和-DI之差的绝对值。

plus_di = talib.PLUS_DI(high, low, close, timeperiod=14)
minus_di = talib.MINUS_DI(high, low, close, timeperiod=14)
result = talib.DX(high, low, close, timeperiod=14)

10. MACD (Moving Average Convergence/Divergence)

简介:MACD是两个不同周期的EMA之差。

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

11. MACDEXT (MACD with controllable MA type)

简介:MACDEXT允许选择不同的MA类型。

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

12. MACDFIX (Moving Average Convergence/Divergence Fix 12/26)

简介:MACDFIX使用固定的12和26周期计算MACD。

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

13. MFI (Money Flow Index)

简介:MFI是资金流量指标,反映资金流入流出情况。

result = talib.MFI(high, low, close, volume, timeperiod=14)

14. MINUS_DI (Minus Directional Indicator)

简介:MINUS_DI是负方向性运动指标。

result = talib.MINUS_DI(high, low, close, timeperiod=14)

15. MINUS_DM (Minus Directional Movement)

简介:MINUS_DM是负方向性运动值。

result = talib.MINUS_DM(high, low, timeperiod=14)

16. MOM (Momentum)

简介:MOM是当前价格与n周期前的收盘价之差。

result = talib.MOM(close, timeperiod=10)

17. PLUS_DI (Plus Directional Indicator)

简介:PLUS_DI是正方向性运动指标。

result = talib.PLUS_DI(high, low, close, timeperiod=14)

18. PLUS_DM (Plus Directional Movement)

简介:PLUS_DM是正方向性运动值。

result = talib.PLUS_DM(high, low, timeperiod=14)

19. PPO (Percentage Price Oscillator)

简介:PPO是价格的百分比变化。

result = talib.PPO(close, fastperiod=12, slowperiod=26, matype=0)

20. ROC (Rate of Change)

简介:ROC是当前价格与n周期前的价格之比。

result = talib.ROC(close, timeperiod=10)

21. ROCP (Rate of Change Percentage)

简介:ROCP是当前价格与n周期前的价格之比的百分比。

result = talib.ROCP(close, timeperiod=10)

22. ROCR (Rate of Change Ratio)

简介:ROCR是当前价格与n周期前的价格之比。

result = talib.ROCR(close, timeperiod=10)

23. ROCR100 (Rate of Change Ratio 100 scale)

简介:ROCR100是ROCR的缩放版本。

result = talib.ROCR100(close, timeperiod=10)

24. RSI (Relative Strength Index)

简介:RSI是衡量价格变动速度和变化的指标。

result = talib.RSI(close, timeperiod=14)

25. STOCH (Stochastic)

简介:STOCH是随机指标,显示价格在一段时间内的相对位置。

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

26. STOCHF (Stochastic Fast)

简介:STOCHF是快速随机指标。

slowk, slowd = talib.STOCHF(high, low, close, fastk_period=5, fastd_period=3, fastd_matype=0)

27. STOCHRSI (Stochastic Relative Strength Index)

简介:STOCHRSI是RSI的随机指标。

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

28. TRIX (Trix)

简介:TRIX是三重指数平滑移动平均线。

result = talib.TRIX(close, timeperiod=30)
  1. ULTOSC (Ultimate Oscillator)

简介:ULTOSC是多个时间框架的加权移动平均线。

result = talib.ULTOSC(high, low, close, timeperiod1=7, timeperiod2=14, timeperiod3=28)

30. WILLR (Williams’ %R)

简介:WILLR是衡量市场超买或超卖的指标。

result = talib.WILLR(high, low, close, timeperiod=14)
此条目发表在量化交易分类目录,贴了, , 标签。将固定链接加入收藏夹。

发表回复