Open aEgoist opened 3 years ago
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.
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.