Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Determining Slope of SMA's

First things first, I'm relatively new to Python and, save for a high school Visual Basic class, coding in general, so please forgive my ignorance. I'm having some difficulty tackling the problem of performing additional actions on outputs of either Pipeline or data.history. I can calculate a security's simple moving average with both without too much difficulty, but how do I perform tasks on a string of SMAs? For example, let's say I calculate the 10-day SMA for SPY but then want to calculate the slope of those results (i.e. the slope of the 10-day SMA of SPY).

I realize that it may be best handled by writing a custom pipeline factor, which I've been attempting to do to no prevail. Any help or shove in the right direction would be greatly appreciated!

-Stephen

1 response

I have also calculated slope multiple times as well, so I'm not necessarily looking for someone to give me a tutorial on how to do that either. I'm simply just trying to connect those two abilities - calculating slope on a rolling set of SMAs.