talib中的MACD指标用法总结【TA-lib的macd返回值的含义】

官方文档:https://mrjbq7.github.io/ta-lib/func_groups/momentum_indicators.html

 

参考1 https://blog.csdn.net/faiy0000/article/details/79977491

参考2 https://blog.csdn.net/qq_37193537/article/details/81103051

 

 

import talib


class CommonTactics:
    @classmethod
    def talib_MACD(cls, df_close_data, fastperiod=12, slowperiod=26):
        """
            talib官方默认参数 fastperiod=12, slowperiod=26,signalperiod=9
            参数:
                fastperiod:快线【短周期均线】
                slowperiod:慢线【长周期均线】
                signalperiod:计算signalperiod天的macd的EMA均线【默认是9,无需更改】
            返回参数:
                macd【DIF】 = 12【fastperiod】天EMA - 26【slowperiod】天EMA
                macdsignal【DEA或DEM】 = 计算macd的signalperiod天的EMA
                macdhist【MACD柱状线】 = macd - macdsignal
        """
        macd, macdsignal, macdhist = getattr(talib, "MACD")(
            df_close_data, fastperiod=fastperiod, slowperiod=slowperiod, signalperiod=9)
        return macd, macdsignal, macdhist

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值