Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Fundamental Moving Average Crossover

This algorithm buys stock when a short-term moving average crosses a longer-term moving average, except it uses gross margin instead of the stock price. The concept would work with many other fundamental metrics as well. It should be possible to code this much more efficiently, this is mostly meant to be a proof-of-concept. It was also created to test the use of fundamental data from multiple prior quarters in an algorithm, and it may be possible to do that more efficiently as well. There is a post on Alpha Architect that discusses algorithms that use both price and fundamental momentum, but it doesn't provide code.