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

关于MA的底层计算原理 #12

Open
dyninfo opened this issue Oct 22, 2022 · 1 comment
Open

关于MA的底层计算原理 #12

dyninfo opened this issue Oct 22, 2022 · 1 comment

Comments

@dyninfo
Copy link

dyninfo commented Oct 22, 2022

假设:close:[0. 1. 2.]
得到的结果如下:
ta.MA([0. 1. 2.], 1) = [0. 1. 2.]
ta.MA([0. 1. 2.], 2) = [nan 0.5 1.5]
ta.MA([0. 1. 2.], 3) = [nan nan 1.]
ta.MA([0. 1. 2.], 4) = [nan nan nan]

关于得到的结果,MA底层具体是怎么计算的呢?

@freedombin
Copy link

ma就是简单的平均数啊,period限制了你取多少个数进行平均:period=1,取一个数进行平均,就是[0,1,2],period=2,滚动取2个数进行平均:类似df.rolling(2)的方法:因为第一个数前面没有数,所有是nan,第二个数是0和1的平均,第三个是1和2的平均,以此类推

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