Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Screening for A Valid Condition within a previous time frame

Editing my earlier post to simplify things,

I am trying to look for a valid condition within the last 10 days. For example if there was a moving average crossover within the last 10 days.

I have tried doing this with the np.any() command but to no avail np.any(SMA_10[-1:-10] > np.any(SMA_50[-1:-10]) but this does not make any trades for me.

1 response

Answered my question - was just a simple syntax error. For anyone looking for an answer in the future it should be structured like:

np.any(SMA_10[-10:-1] > (SMA_50[-10:-1])