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

CROSS结果不对 #35

Open
schild opened this issue Jul 23, 2022 · 2 comments
Open

CROSS结果不对 #35

schild opened this issue Jul 23, 2022 · 2 comments

Comments

@schild
Copy link

schild commented Jul 23, 2022

使用上穿时,debug肯定是有True的地方,事实结果全是flase
s1 = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16])
s2 = pd.Series([6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,6])
s1 = MA(s1, 3)
s2 = MA(s2, 5)
c = CROSS(s1, s2)

结果全是false

@schild
Copy link
Author

schild commented Jul 23, 2022

image
补上截图

@schild
Copy link
Author

schild commented Jul 23, 2022

自己本地修改成,感觉有点臃肿代码如下:
return np.concatenate(([False], pd.Series(np.array(np.logical_not((S1>S2)[:-1])) & np.array((S1>S2)[1:]))))
或许reset_index看起来更简洁,我也不确定,先用现在这版

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

1 participant