-
Notifications
You must be signed in to change notification settings - Fork 539
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函数计算结果处理错误,修正建议 #36
Comments
我也遇到这个问题,修正有效 |
计算结果确实与同花顺的有出入,改成如下代码后,结果一致了: def CROSS(S1, S2):
res = pd.Series(S1) > pd.Series(S2)
return ((res == True) & (res.shift(-1) == False)).shift() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def CROSS(S1, S2): # 判断向上金叉穿越 CROSS(MA(C,5),MA(C,10)) 判断向下死叉穿越 CROSS(MA(C,10),MA(C,5))
return np.concatenate(([False], np.logical_not((S1>S2)[:-1]) & (S1>S2)[1:])) # 不使用0级函数,移植方便 by jqz1226
改成:
def CROSS(S1, S2): # 判断向上金叉穿越 CROSS(MA(C,5),MA(C,10)) 判断向下死叉穿越 CROSS(MA(C,10),MA(C,5))
return np.concatenate(([False], np.logical_not((S1 > S2)[:-1]) & (S1 > S2)[1:].reset_index(drop=True)))
The text was updated successfully, but these errors were encountered: