mpquant / MyTT

MyTT将通达信,同花顺,文华麦语言等指标公式,最简移植到Python中,核心库单个文件,仅百行代码,十几个核心函数,神奇的实现所有常见技术指标算法(不依赖talib库)的纯python实现和转换通达信MACD,RSI,BOLL,ATR,KDJ,CCI,PSY等公式,全部基于pandas函数计算方法封装,简洁且高性能,能非常方便的应用在股票指标公式,股市期货量化框架分析,自动程序化交易,数字货币量化等领域,它是您最精练的股市量化工具。Python library with most stock market indicators.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

贡献3个函数:量比,钱龙短线指标,钱龙长线指标

chorespore opened this issue · comments

def QRR(VOL):  # 量比(Quantity Relative Ratio)
    return (VOL / MA(REF(VOL), 5)).values


def SHO(CLOSE, VOL, N=5):  # 钱龙短线指标(Short)
    VAR1 = MA((VOL - REF(VOL, 1)) / REF(VOL, 1), 5)
    VAR2 = (CLOSE - MA(CLOSE, 24)) / MA(CLOSE, 24) * 100
    SHT = VAR2 * (1 + VAR1)
    SHTMA = MA(SHT, N)
    return SHT, SHTMA


def LON(CLOSE, HIGH, LOW, VOL):  # 钱龙长线指标(Long)
    LC = REF(CLOSE, 1)
    VID = SUM(VOL, 2) / (((HHV(HIGH, 2) - LLV(LOW, 2))) * 100)
    RC = (CLOSE - LC) * VID
    LONG = SUM(RC, 0)
    DIFF = SMA(LONG, 10, 1)
    DEA = SMA(LONG, 20, 1)
    LON = DIFF - DEA
    LONMA = MA(LON, 10)
    return LON, LONMA
commented

感谢分享!