Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于DMA函数的定义 #14

Open
qzhjiang opened this issue Oct 22, 2021 · 1 comment
Open

关于DMA函数的定义 #14

qzhjiang opened this issue Oct 22, 2021 · 1 comment

Comments

@qzhjiang
Copy link

看了一下myTT中对DMA函数的定义:

# myTT定义的DMA
def DMA(CLOSE, N1=10, N2=50, M=10):  # 平行线差指标
    DIF = MA(CLOSE, N1) - MA(CLOSE, N2)
    DIF_MA = MA(DIF, M)
    return DIF, DIF_MA

显然,与通达信的动态移动平均函数DMA不是一回事。

为此,给出与通达信完全一致的DMA函数定义:

# jqz1226定义的DMA, 通达信动态移动平均, py3版
def DMA(S, A):
    return pd.Series(S).ewm(alpha=A, adjust=False).mean().values
# jqz1226定义的DMA, 通达信动态移动平均, py2版
def DMA(S, A):
    return pd.ewma(S,com=1.0/A - 1,adjust=False)
@mpquant
Copy link
Owner

mpquant commented Oct 23, 2021

感谢指正,已 update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants