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 函数没有顺序性? #4

Open
ppalantir opened this issue Jun 18, 2021 · 3 comments
Open

CROSS 函数没有顺序性? #4

ppalantir opened this issue Jun 18, 2021 · 3 comments

Comments

@ppalantir
Copy link

测试了一下为什么CROSS(MA(CLOSE, 30), MA(CLOSE, 10))和CROSS(MA(CLOSE, 10), MA(CLOSE, 30)) 返回的结果是一样的呢?
30日线穿过10日线,和10日线穿过30日线按理说应该不一样才对
求解答

@ppalantir
Copy link
Author

ppalantir commented Jun 22, 2021

修复了,感觉这样才有意义

def CROSS(S1,S2): 
    CROSS_BOOL=IF(S1>S2, True ,False)   
    return (COUNT(CROSS_BOOL>0,2)==1)*CROSS_BOOL

buy_signal = CROSS(ma10, ma30) # 找出10日线上穿30日线的点
sell_signal = CROSS(ma30, ma10) # 找出30日线上穿30日线的点

如果使用原版,不修复
buy_signal = CROSS(ma10, ma30) # 找出10日线上穿30日线的点
sell_signal = CROSS(ma30, ma10) # 找出30日线上穿30日线的点
buy_signal和sell_signal得到的结果是一样的

@mpquant mpquant reopened this Aug 2, 2021
@mpquant
Copy link
Owner

mpquant commented Aug 2, 2021

赞!

@mpquant
Copy link
Owner

mpquant commented Aug 14, 2021

Thanks yxyangxu ,MyTT had update!

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