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

错误应该挺多的 #34

Open
peakgao opened this issue Jul 22, 2022 · 0 comments
Open

错误应该挺多的 #34

peakgao opened this issue Jul 22, 2022 · 0 comments

Comments

@peakgao
Copy link

peakgao commented Jul 22, 2022

刚才测试了HHV和HHVBARS,发现跟通达信不同,你在通达信里面选择一个才上市的日K线少的股票测试一下就知道.,比如301302
HIGH
array([72.99, 64.79, 64.8 , 64.94, 67.21, 63.98, 69.6 , 72.12, 75. ,
72.72, 74.23, 70.33, 68.82, 65.38, 63.89, 66. , 66.52, 64.77,
66.4 , 68.68, 67.58])

HHV(HIGH,5)
array([ nan, nan, nan, nan, 72.99, 67.21, 69.6 , 72.12, 75. ,
75. , 75. , 75. , 75. , 74.23, 74.23, 70.33, 68.82, 66.52,
66.52, 68.68, 68.68])

HHVBARS(HIGH,5)
array([nan, nan, nan, nan, 4., 1., 0., 0., 0., 1., 2., 3., 4.,
3., 4., 4., 4., 1., 2., 0., 1.])

你们看看,这个是需要的结果么,肯定要把nan消除.
应该改成这样,加一个min_periods=1,HHVBARS也类似:

def HHV(S,N): #HHV(C, 5) 最近5天收盘最高价
return pd.Series(S).rolling(N,1).max().values

还有个问题,如果这个N是个序列,比如通达信里面可以这样:
M:=500;
HH1:=HHV(HIGH,M);{高点1}
HP1:=HHVBARS(HIGH,M);{高点1位置}
LL1:=LLV(LOW,M);{低点1}
LP1:=LLVBARS(LOW,M);{低点1位置}

HH2:=HHV(HIGH,LP1);{高点2} # 转成python后,这个LP1是序列,执行这行就崩溃了
HP2:=HHVBARS(HIGH,LP1);{高点2位置}
如果是序列,应该每根K线取对应的LP1里面的值,这个怎么写?没细想,:)

另外还有不少函数没实现,稍微复杂的公式,就发现没法跑

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