Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Slope of moving average line, also futures symbols?

I need to get the slope of the moving average lines, or at least know when they are flat or down. Is there a way to do this or do I just have to make and if statement referencing the last moving average bar vs this moving average bar, I would prefer the slope.

Any ideas? FYI I am new to programming.

Also I would like to trade the ES, can quantopian do that? What is the symbol/SID for the ES I cannot find it.

1 response

You can use http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.stats.linregress.html to get the slope of moving average lines. You can also check the pvalue to see if slope is not zero. Hope that helps.