Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to build a Z-Score Indicator for the 10 bar range?

For example, is the current 10 bar range 2 standard deviations away from the average?

(The average being what is recent. I attempted to use a 400 bar rolling average)

How would you code it? My code (attached) results in an error:

2 responses

@tradr

Try to replace

MAX = max((High[-10:-1]))  
MIN = min((Low[-10:-1])) 

to

MAX = High.rolling(10).max()  
MIN = Low.rolling(10).min()  

@ Vladimir

Thanks! That seems to have resolved the issue.