MyTT icon indicating copy to clipboard operation
MyTT copied to clipboard

CROSS结果不对

Open schild opened this issue 3 years ago • 2 comments

使用上穿时,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 avatar Jul 23 '22 14:07 schild

image 补上截图

schild avatar Jul 23 '22 14:07 schild

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

schild avatar Jul 23 '22 15:07 schild