TAMomentum
动量指标补充文档
本目录包含剩余动量指标的简要文档。
TA.MACDEXT() - MACD扩展版
可自定义移动平均类型的MACD。
python
TA.MACDEXT(data, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0)MA类型:0=SMA, 1=EMA, 2=WMA, 3=DEMA, 4=TEMA, 5=TRIMA, 6=KAMA, 7=MAMA, 8=T3
TA.APO() - 绝对价格振荡器
python
TA.APO(data, fastperiod=12, slowperiod=26, matype=0)MACD的简化版,返回快慢线差值。
TA.TRIX() - 三重指数平滑移动平均
python
TA.TRIX(data, timeperiod=30)通过三次EMA平滑,过滤短期波动,识别长期趋势。
TA.AROONOSC() - 阿隆振荡器
python
TA.AROONOSC(high, low, timeperiod=14)Aroon Up - Aroon Down,范围-100到+100。
TA.BOP() - 均势指标
python
TA.BOP(open, high, low, close)衡量买卖双方力量对比。
TA.PLUS_DI() / TA.MINUS_DI() - 方向指标
python
TA.PLUS_DI(high, low, close, timeperiod=14)
TA.MINUS_DI(high, low, close, timeperiod=14)ADX系统的组成部分,+DI表示上升动力,-DI表示下降动力。
TA.PLUS_DM() / TA.MINUS_DM() - 方向运动
python
TA.PLUS_DM(high, low, timeperiod=14)
TA.MINUS_DM(high, low, timeperiod=14)计算上升和下降方向的运动值。
TA.DX() - 方向指数
python
TA.DX(high, low, close, timeperiod=14)衡量趋势强度,ADX的前身。
TA.ADXR() - 平均方向指数评估
python
TA.ADXR(high, low, close, timeperiod=14)ADX的平滑版本。
TA.MACDFIX() - 固定参数MACD
python
TA.MACDFIX(data, signalperiod=9)固定12/26周期的MACD,只可调整信号线周期。
TA.ADOSC() - 累积/派发振荡器
python
TA.ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)A/D线的振荡器版本。
TA.ROCR() - 变动率比率
python
TA.ROCR(data, timeperiod=10)ROC的比率形式。
TA.ROCP() - 变动率百分比
python
TA.ROCP(data, timeperiod=10)ROC的百分比形式。
使用示例
python
def main():
records = exchange.GetRecords()
if len(records) < 50:
return
highs = [r['High'] for r in records]
lows = [r['Low'] for r in records]
closes = [r['Close'] for r in records]
# 示例:使用TRIX
trix = TA.TRIX(closes, 30)
if trix[-1] > 0 and trix[-2] <= 0:
Log("TRIX金叉")
# 示例:使用BOP
opens = [r['Open'] for r in records]
bop = TA.BOP(opens, highs, lows, closes)
if bop[-1] > 0:
Log("买方占优")