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

make 'crossany' more useful #103

Open
aEgoist opened this issue Oct 8, 2020 · 1 comment
Open

make 'crossany' more useful #103

aEgoist opened this issue Oct 8, 2020 · 1 comment

Comments

@aEgoist
Copy link

aEgoist commented Oct 8, 2020

crossany returns 1 both crossover and crossunder situations
why not return 1 for crossover and -1 for crossunder? then use abs(crossany(..)) to get the original returns if needed.
thus we can get crossover and crossunder in a single calculation, otherwise we'd have to call crossover(a,b) and crossover(b,a) to do so.

@codeplea
Copy link
Member

codeplea commented Oct 8, 2020

I wouldn't want to change the existing cossany() or crossover() functions. They are very useful signals for vectorized algorithms.

It might make sense to create a new function, call it crossdir(), that indicates direction by returning a -1 or 1, as you describe.

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